Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot evaluate because of compilation error(s). Occurs within watch expressions. #1096

Open
mpette200 opened this issue Dec 7, 2021 · 5 comments
Assignees

Comments

@mpette200
Copy link

While debugging, watches display "Cannot evaluate because of compilation error(s): ......". This is annoying, and actually the same issue seems to prevent conditional breakpoints from working. This seems to occur whenever an inner class is present within the method.

Environment
  • Operating System: Microsoft Windows [Version 10.0.19042.1348]
  • JDK version: jdk-11.0.12
  • Visual Studio Code version: 1.62.3 (user setup)
  • Java extension version: Java(TM) by Red Hat v1.1.0
  • Java Debugger extension version: v0.37.0
Steps To Reproduce
  1. Create the slightly modified "Hello World" by copy / pasting the code below.
  2. Add a breakpoint then debug.
  3. Set a watch expression for msg.length()
import java.util.List;
import java.util.ArrayList;

public class Hello {
    public static void main(String[] args) {
        
        class Position {
            int x;
            int y;
        }
        
        String msg = "Hello World";
        List<Position> x = new ArrayList<>();
        System.out.println(msg + x);
    }

}
Current Result

image

Expected Result

msg.length() should evaluate to a number.

Additional Informations

If I move the "class Position {}" so that it is no longer an inner class then the debugger seems to work correctly.

@testforstephen
Copy link
Contributor

Thanks for the information. I can reproduce it, it's a bug.

@testforstephen
Copy link
Contributor

Opened an issue at the upstream JDT. https://bugs.eclipse.org/bugs/show_bug.cgi?id=578148

@jasondamour
Copy link

RIP

@HairyMike
Copy link

any update? been a few years

@imacrazyguylol
Copy link

Would greatly appreciate this to be fixed, just encountered it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants