wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes tool to identify unused methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "tool to identify unused methods" Watch "tool to identify unused methods" New topic
Author

tool to identify unused methods

Mark Lybarger
Ranch Hand

Joined: Dec 19, 2003
Posts: 72
is there a tool which will identify unused methods for classes? we have a code base which is probably 3 years old and after much refactoring and such there's most certainly methods that got replaced but never removed.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

There are tools to test code coverage - JBuilderX springs to mind. I think its got that sort of profiling capabilities. Nothing however beats a proper manual code review - especially when you got technologies like Reflection where methods might not be directly refered to by other classes, but are used at run time.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

There are a number of decent static analysis tools available that will do this -- no need to subject humans to that sort of bookkeeping work. IntelliJ IDEA has this built in, but there's also the open-source PMD.


[Jess in Action][AskingGoodQuestions]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
The Code Guide IDE can do that, as far as I know. You simply tell it all the root classes (main class, classes loaded via reflection etc.), and it flags all unreachable code. Haven't tried it yet, though.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Ernest Friedman-Hill:
there's also the open-source PMD.


From the description on the homepage it seems as if it only works for private methods, which is rather trivial (Eclipse can do that, too).

Finding unused *public* methods would be helpfull for us, too. Sadly, my feature request has been without effect until now...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tool to identify unused methods
 
Similar Threads
How to determine uncalled functions?
Tool to clean source code?
Problem with properties file
Tool for JVM instance Identifier
difference between gc and runFinalization