I am looking out for an eclipse plug-in that could be used to detect unused methods or classes across a project. Does any one know a efficient good to use plug-in of that kind?
Asked
Active
Viewed 1.1k times
2 Answers
15
- Findbugs (which has an eclipse plugin) can show you "dead code" (through the CalledMethods detector)
- UCDetector also provide that kind of feature
Of course, any of those tools can NOT deterministically find unused code (see the Halting Problem). Any code could eventually be called, through various means like Reflection.
But those static analysis tools can help.
For additional hints, a good test coverage is still required (dynamic analysis).

Glorfindel
- 21,988
- 13
- 81
- 109

VonC
- 1,262,500
- 529
- 4,410
- 5,250
3
Something like EclEmma (http://www.eclemma.org/) might be what you're looking for. It shows code coverage for packages, classes, methods and individual lines.
Some lines will never get 100% coverage (e.g. Enums) but it will give you a good idea about what's being used.

Rich Seller
- 83,208
- 23
- 172
- 177

BobBrez
- 723
- 7
- 22
-
1assuming you have a comprehensive test suite or manually run the code each time – Rich Seller Oct 09 '09 at 09:57