假设我有以下类,并希望在标记的位置为arg == null设置条件断点。这在eclipse中不起作用,并给出错误“条件断点有编译错误。原因:arg无法解析为变量”。我发现一些相关信息here,但即使我将条件更改为“val $ arg == null”(val $ arg是调试器变量视图中显示的变量名称),eclipse也给我提供了相同的错误。如何根据最终的局部变量在匿名内部类中设置条件断点?
public abstract class Test {
public static void main(String[] args) {
Test t1 = foo("123");
Test t2 = foo(null);
t1.bar();
t2.bar();
}
abstract void bar();
static Test foo(final String arg) {
return new Test() {
@Override
void bar() {
// I want to set a breakpoint here with the condition "arg==null"
System.out.println(arg);
}
};
}
}
条件断点*杀*性能,因此解决方法是不是*,在我的眼睛... *丑 – 2011-01-19 09:41:00