Lint Tool to detect unused public methods?

I'm looking for a java lint tool that will point out <b>public</b> methods that

are unused within my codebase. All of the tools I've reviewed to date

have only detected unused private methods. Does such a tool exist?

If so, can you point me in the right direction?

[303 byte] By [es5f2000a] at [2007-10-1 14:51:32]
# 1
And what happens if one of your methods is called by reflection?
jschella at 2007-7-10 18:41:42 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 2
Well, then I would lose in a horrible, messy fashion. However, I've written every single line of the codebase, and I'm 100% sure that there's no reflection.Unless, of course, the Ninja Coding Gremlins got at my repository while I wasn't looking.
es5f2000a at 2007-7-10 18:41:42 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 3

I don't think such a tool can exist, because the tool wouldn't know whether your writing an API or an end user application.

Also, in any program you might end up with public methods that do nothing, but need to be there to complete an interface implementation.

Presumably, the goal with finding the unused public methods is to remove them and to improve performance somehow. I don't think this is a worthwhile exercise as the compiler does a pretty good job of this optimisation already.

sp00kera at 2007-7-10 18:41:42 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 4

ProGuard can list (and remove) unused classes, fields, and methods in a (compiled) codebase. You just have to specify all entry points, like the "main" method of your application. ProGuard is also an optimizer and an obfuscator. It is freely available under the GPL: http://proguard.sourceforge.net/

The site also contains a list of alternative shrinking/compacting tools, which may be able to do what you need.

Eric (author of ProGuard).

lafortunea at 2007-7-10 18:41:42 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 5
Spiffy, I will take a look at it. Thanks!
es5f2000a at 2007-7-10 18:41:42 > top of Java-index,Archived Forums,Debugging Tools and Techniques...