Not using any instance variables indicates that they should be static methods. Is there a way to configure Eclipse or FindBugs to show warnings for this kind of methods?
Asked
Active
Viewed 133 times
0
-
If that was expanded to include not using any instance methods I could see the premise being true. I started my custom detectors using [this article](http://www.ibm.com/developerworks/library/j-findbug2/); man that seems like a long time ago now. – Dave Newton Dec 11 '11 at 19:49
-
They should also be private or final, because else a subclass might want to override the method and use instance methods/variables. – JB Nizet Dec 11 '11 at 22:16
-
If in Eclipse Window->Tools->Java Compiler->Errors/Warnings->Code Style-> **Method can be static** and **Method can potentially be static** is what you're looking for, I'd turn this into an answer. – Marco13 Mar 28 '15 at 14:24
1 Answers
0
Looking through the findbugs bug descriptions I couldn't find any detector that matches your specific use case. So you would either have to use a different tool that supports this analysis or write your own.
A quick search brings up many different tutorials on how to write a custom detector.
As to whether it's a good idea to make every method static if possible, you could also refer to this great stackoverflow answer.

Community
- 1
- 1

Fabian Streitel
- 2,702
- 26
- 36