Reputation: 6209
I got this warning a lot of times for private methods. How to make Eclipse show the same (or similar) warning for public, default and protected methods?
Upvotes: 1
Views: 20390
Reputation: 22070
Eclipse cannot do that, as public methods might be used from code that is not visible in the current workspace. But you could use the Unnecessary Code Detector Plugin to find such methods.
Upvotes: 5
Reputation: 691685
Doing it for private methods is easy because the scope to search for usage of the method is limited (only the class itself), and because the warning makes sense: since it's private, nobody from the outside can call the method, and since it's not called from inside the project, the method is probably useless, hence the warning.
Doing it for default methods could be done.
But doing it for public and protected methods would be counter-productive most of the time, because public and protected methods are part of the public interface of your classes, which could be used by other classes, out of the scope of the current eclipse project.
AFAIK, eclipse doesn't come with such a tool. But the UCDetector plugin can find unused code in your project. Use with caution!
Upvotes: 2