简体   繁体   English

Eclipse /条件断点导致BreakpointException

[英]Eclipse / conditional breakpoint results in BreakpointException

I want to debug a static inner class, which is actually a Callable. 我想调试一个静态内部类,它实际上是一个Callable。 Whenever I try to set a conditional breakpoint in Eclipse I get the breakpoint error: 每当我尝试在Eclipse中设置条件断点时,我都会收到断点错误:

The type com.sun.source.tree.Tree$Kind cannot be resolved. 类型com.sun.source.tree.Tree$Kind无法解析。 It is indirectly referenced from required .class files. 它是从所需的.class文件间接引用的。

What is causing this error? 导致此错误的原因是什么? Is it a bug in the class/package that uses com.sun.source.tree.Tree$Kind but does not provide it? 这是使用com.sun.source.tree.Tree$Kind的类/包中的错误但不提供它? How do I find out which class it is? 我怎么知道它是哪一堂课? How do I resolve it? 我该如何解决?


An example expression which should be correct is: return mRtx.getNode().getNodeKey() == 74; 应该正确的示例表达式是: return mRtx.getNode().getNodeKey() == 74;

I have changed it to mRtx.getNode().getNodeKey() == 74 but still the same error. 我已将其更改为mRtx.getNode().getNodeKey() == 74但仍然是相同的错误。 Recently I've found the bug and simply used: 最近我发现了这个bug并且简单地使用了:

 if (mRtx.getNode().getNodeKey() == 74) {
     System.out.println("bla");
 }

and set a "normal" breakpoint on the "sysout" statement just in case someone has the same problem. 并在“sysout”语句中设置“正常”断点,以防有人遇到同样的问题。

I am not sure on how I would reproduce it as your description is not exactly telling much. 我不确定如何重现它,因为你的描述并不是很清楚。

The com.sun.source.tree package is included in tools.jar, which is part of JDK but not of JRE, so make sure you run your Eclipse in JDK (JAVA_HOME variable?), maybe try setting projects JRE to a JDK folder. com.sun.source.tree包包含在tools.jar中,它是JDK的一部分而不是JRE的一部分,所以请确保在JDK中运行Eclipse(JAVA_HOME变量?),也许尝试将项目JRE设置为JDK文件夹。

I also think that the Compiler API was introduced in Java 6, so check if you are not using a lower version. 我还认为Compiler API是在Java 6中引入的,因此请检查您是否使用了较低版本。

Maybe you should try to edit the debugger's source lookup. 也许您应该尝试编辑调试器的源查找。

To do this, go to debug perspective, in the debug view (where the stack is normally shown) right click on the terminated run, and choose 'Edit Source Lookup...'. 要执行此操作,请转到调试透视图,在调试视图中(通常显示堆栈)右键单击已终止的运行,然后选择“编辑源查找...”。

Then you can add a lookup place. 然后,您可以添加查找位置。 In this case you should maybe add the tools.jar that is in the jre folder. 在这种情况下,您应该添加jre文件夹中的tools.jar。

The compiler can't find the type, that is the root issue, but in my thinking, this should only be a compile time error, but by implication from what I read, it's a run time error. 编译器找不到类型,这是根本问题,但在我看来,这应该只是一个编译时错误,但是从我读到的含义来看,这是一个运行时错误。 Is that correct? 那是对的吗?

Here is are some tips: 以下是一些提示:

http://java.syntaxerrors.info/index.php?title=Cannot_resolve_type http://java.syntaxerrors.info/index.php?title=Cannot_resolve_type

Indirectly referenced from required .class file 从所需的.class文件中间接引用

Maybe you could post more code or use "control + T" in Eclipse on the class to look at the type hierarchy, I would like to know what other classes are referenced. 也许您可以在类中发布更多代码或使用Eclipse中的“control + T”来查看类型层次结构,我想知道引用了哪些其他类。

HTH, HTH,

James 詹姆士

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM