如何配置 Eclipse/FindBugs 以警告不使用任何实例变量的方法?

发布于 2024-12-20 19:36:23 字数 66 浏览 2 评论 0原文

不使用任何实例变量表明它们应该是静态方法。有没有办法配置 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伪装你 2024-12-27 19:36:23

浏览 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文