开发者

Find dead class in Java with Eclipse

I am new ( and only person ) on old Java project. Couple guys have developed this before me. Is there any tool ( plugin for Eclipse would be 开发者_如何转开发nice ) which can find in project dead classes ( classes that are declared but they don't use anymore anywhere ?


You could use the Emma plugin to determine code coverage and look for the classes with 0% coverage after a full run.

To make sure before you remove classes, use the eclipse function that shows all references to the class in case it is used in exception handling.


Looks like similar question already asked on Stackoverfow check out the following links already asked on SO

  • How to find unused/dead code in java projects
  • Find unused classes in a Java Eclipse project

Check out the answers


http://eclipsenuggets.blogspot.com/2007/05/here-is-quick-way-to-eliminate-dead.html

This worked for me (although I tried it several years ago)


IntelliJ has a "Find Usages" that you can apply to classes, methods, strings - anything. Perhaps the Eclipse help can turn up such a thing.

Or maybe you should switch to IntelliJ.

IntelliJ can also generate UML that includes dependencies. Any class or package without a dependency would be a good candidate for removal. You'd get a quick visual that way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜