码迷,mamicode.com
首页 > 数据库 > 详细

FindBugs Tutorial

时间:2015-05-22 00:19:25      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:

FindBugs is an useful tool that can find potential problematic code in your Java program. It differs from CheckStyle and PMD in that it analyzes Java bytecode, not the human-readable source file, to find potential bug patterns. Follow this tutorial to see how to use FindBugs in Eclipse!

 

1. In Eclipse, click Help -> Install new software. In the opened dialogue, click "Add". Type in FindBugs as the name and "http://findbugs.cs.umd.edu/eclipse" as the URL. Click "OK" to proceed.

 

2. Select "FindBugs" and click "Next"

技术分享

 

3. Eclipse will begin downloading the software. Agree to any prompted licenses or user agreements to proceed.

 

4.  Right-click the project, select Find Bugs -> Find Bugs in the context menu.

技术分享

 

5. Wait a few seconds/minutes while it checks your project

技术分享

 

6. When finished, it will report how many bugs it has found. Click "yes" to open the FindBugs perspective to view the bugs.

技术分享

 

7. In the Bug Explorer window, you can see a summary of the bugs found.

技术分享

8. Double click one bug to see exactly which line is problematic. Here it says two strings should be compared with the "equals()" method, not the  "==" operator.

技术分享

 

 9. Make changes accordingly, and check again to make sure there are no more bugs.

技术分享

 

That‘s all for this tutorial. Hopefully you‘ll find it useful. More information about FindBugs can be found at http://findbugs.sourceforge.net/.

 

Feedbacks and suggestions are greatly appreciated.

 

FindBugs Tutorial

标签:

原文地址:http://www.cnblogs.com/tuhz/p/4521066.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!