General J2EE: How to find dead code
There is a lot of tools that tell me that a private method is dead code (Eclipse, by example), but I can't find a tool to tell me a public or protected method is never used. I know it's harder to code, but not that hard ?
Do anybody know a tool that is able to discover dead code in unused public method, unused classes ?
I know it's harder to code, but not that hard ?
I think it is not harder to code but simply impossible.
How do you want to find method invocations done by using reflection?
Many tools do this (though not with 100% reliability, they can't see if you call a method with reflection). However, in order to do their job they must see and analyze ALL your code. This is expensive, so they do it only when you ask for a coverage report.
If my memory serves me IntelliJ IDEA does it. TogetherJ did it a long time ago, so I assume that JBuilder can do it now. I bet there is a plug-in for Eclipse, but I haven't seen one.
You can download a trial version of IDEA from http://www.jetbrains.com and try it out.