开发者

Handle into eclipse's parsing of java code?

How does eclipse internally build its internal representation of java code in order to be able to detect things like unreferenced methods, or to find method references in a project? And is there any way to get a hook into that information to build tool开发者_开发百科s based on eclipse's internal parsing, Whether as an eclipse plug-in or as a standalone? (for use in building some small tools for dead-code detection)

The closest thing I've found would involve building my own representations using bcel, but that definitely smells of reinventing the wheel.


Eclipse's ASTParser (link 2) (link 3) is where you should start looking.


There are tools for doing that, unless you are really keen on writing it yourself (as you've put it: reinventing the wheel).

FindBugs is a popular tool (don't let the 90's façade fool you) for detecting all sorts of problems in your code.

As for finding references, if Eclipse mechanism is not enough for your, check out nWire for Java, a code exploration tool.

And, yes, AST would be a good start. There are many questions on this subject, browse around.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜