In Eclipse, how do you find methods that you have defined but not used/called anywhere in the app?
I am concerned that some of the classes in my app have methods that are defin开发者_运维百科ed but not called anywhere in the app.
In Eclipse is there a way to find these methods?
You can use Findbugs for this, but there's also a plugin dedicated to this: UCDetector.
Here's a related question and answers and a few other helpful links;
Find unused classes in a Java Eclipse project How to find unused/dead code in java projects http://www.velocityreviews.com/forums/t389551-identify-unused-methods.html
http://pmd.sourceforge.net/eclipse/
Hope that helps.
The quickest way to find usages of a single method would be to highlight the method, right click and go to "References", from there you can choose search location like workspace, project etc.
Obviously this wouldn't be a good way to find ALL the methods in the project that aren't being used, but it might be worth using if you just looking at one odd looking method that you can't figure out why you need.
精彩评论