1. Run FindBugs Automatically开关
当此项选中后,FindBugs将会在你修改Java类时自动运行,如你设置了Eclipse自动编译开关后,当你修改完Java文件保存,FindBugs会运行,并将相应的信息显示出来。
当此项没有选中,你只能每次在需要的时候自己去运行FindBugs来检查你的代码。
2. Minimum priority to report选择项
这个选择项是让你选择哪个级别的信息进行显示,有Low、Medium、High三个选择项可以选择,很类似于Log4J的级别设置啦。 比如:
你选择了High选择项,那么只有是High级别的提示信息才会被显示。
你选择了Medium选择项,那么只有是Medium和High级别的提示信息才会被显示。
你选择了Low选择项,那么所有级别的提示信息都会被显示。
3. Enable bug categories选择项
在这里是一些显示Bug分类的选择:
Correctness关于代码正确性相关方面的
Performance关于代码性能相关方面的
Internationalization关于代码国际化相关方面的
Multithreaded correctness关于代码多线程正确性相关方面的
Style关于代码样式相关方面的
Malicious code vulnerability关于恶意破坏代码相关方面的
比如:如果你把Style的检查框去掉不选择中它,那么与Style分类相关的警告信息不会显示了。其它的类似。
4. Select bug patterns to check for选择项
在这里你可以选择所要进行检查的相关的Bug Pattern条目
可以从Bug codes、Detector name、Detector description中看到相应的是要检查哪些方面的内容,你可以根据需要选择或去掉相应的 检查条件。
总结
此插件的功能很不错,可以帮助我们提升Java代码的编写能力,写出更加安全可靠的代码。建议使用或加在Ant里进行持续构建。
现在,你可以马上拿出你已经开发的一个项目,检查一下你的代码有没有问题了。
刚刚发现了另外一种更加简单的安装方法,详情见:http://findbugs.cs.umd.edu/eclipse
If you have previously installed a version of the FindBugs plugin prior to mid-May, 2006, then you should remove it first. Simply remove the de.tobject.findbugs_0.0.n directory from Eclipse's plugins directory.
To install the FindBugs plugin:
1. In Eclipse, click on Help -> Software Update -> Find and Install...
2. Choose the Search for new features to install option, and click Next.
3. Click New Remote Site.
4. Enter the following:
* Name: FindBugs update site
* URL: one of the following (note: no final slash on the url)
o http://findbugs.cs.umd.edu/eclipse for official releases
o http://findbugs.cs.umd.edu/eclipse-candidate for candidate releases and official releases
o http://findbugs.cs.umd.edu/eclipse-daily for all releases, inculding developmental ones
and click OK.
5. "FindBugs update site" should appear under Sites to include in search.
Click the checkbox next to it to select it, and click Finish.
6. You should see FindBugs Feature under Select features to install.
(You may have to click on one or two triangles to make it visible in the tree.)
Select the checkbox next to it and click next.
7. Select the I accept option to accept the license and click Next.
8. Make sure the location is correct where you're installing it. The default (your workspace) should be fine. Click Finish.
9. The plugin is not digitally signed. Go ahead and install it anyway.
10. Click Yes to make Eclipse restart itself.