开发者

Eclipse / conditional breakpoint results in BreakpointException

I want to debug a static inner class, which is actually a Callable. Whenever I try to set a conditional breakpoint in Eclipse I get the breakpoint error:

The type com.sun.source.tree.Tree$Kind cannot be resolved. It is indirectly referenced from required .class files.

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? 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;

I have changed it to mRtx.getNode().getNodeKey() == 74 but still the same error. Recently I've found the bug 开发者_运维知识库and simply used:

 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.


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.

I also think that the Compiler API was introduced in Java 6, so check if you are not using a lower version.


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.


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

Indirectly referenced from required .class file

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.

HTH,

James

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜