In my code, I am trying to output the value of src
in the expressions window.
public void doIt() {
String src = "test";
System.out.println(src);
}
In Eclipse. I set a breakpoint on a line 3, and I open the "Expressions" window.
I add an expression src
to evaluate, and I get
I've used the Expressions features... COUNTLESS times in my years of Java debugging.. Why does this happen now?
I've just recently started using Eclipse Juno.. vs Indigo. Did they change the way Expressions work?
If your code use any generics, you may want to check this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=341232
Occurs in all version of Eclipse up to 4.2. In short certain generics expressions cause Eclipse to completely fail on any evaluation (please see this example: https://bugs.eclipse.org/bugs/attachment.cgi?id=224760). Not sure whether your code uses any generics, but if so, this may be it. Note that it is enough to have one of the troublesome generics somewhere in your class, not necessary in your method.
I just spent TONS of time to figure out that if you will create a package "Foo" and inside this package you'll create class called "Foo", like this:
package Foo;
public class Foo{
public Foo () {};
}
After the point when you use this class first time in your program, you will not be able to use expressions anymore:
import Foo.Foo; //this is the devil i think
public static void main(String[] args){
EventQueue.invokeLater(new Runnable(){
public void run(){
//debug expressions works fine
Foo tmp = new Foo();
//debug expressions wouldn't work anymore
}
});
}
This bug can be reprodused up to current Eclipse Neon 4.7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With