【发布时间】:2011-01-19 09:26:53
【问题描述】:
假设我有以下课程,并希望在标记位置的 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);
}
};
}
}
【问题讨论】:
标签: java eclipse conditional-breakpoint anonymous-inner-class