如何配置 Eclipse/FindBugs 以警告不使用任何实例变量的方法?
不使用任何实例变量表明它们应该是静态方法。有没有办法配置 Eclipse 或 FindBugs 以显示此类方法的警告?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
浏览 findbugs bug 描述 我找不到任何与您的特定用例相匹配的检测器。因此,您要么必须使用支持此分析的不同工具,要么编写自己的工具。
快速搜索会带来许多关于如何编写定制探测器。
至于如果可能的话,让每个方法都静态是否是一个好主意,您还可以参考这个很棒的 stackoverflow 答案。
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.