首页 > 代码库 > Findbugs

Findbugs

今天发现项目代码加入了findbugs的依赖包,简单的搜索了下:

官方说明:

FindBugs is a defect detection tool for Java that uses static analysis to look for more than 200 bug patterns, such as null pointer dereferences, infinite recursive loops, bad uses of the Java libraries and deadlocks. FindBugs can identify hundreds of serious defects in large applications (typically about 1 defect per 1000-2000 lines of non-commenting source statements). FindBugs is open source, and has been downloaded more than 230,000 times, and is used by many major companies and financial institutions.
Findbugs can be used from the command line or within ant, eclipse, maven, netbeans and emacs.

FindBugs是一个缺陷检测工具为Java使用静态分析来寻找超过200个bug模式,如空指针解引用,无限递归循环, Java库和死锁的不良用途。 FindBugs的可以识别在大型应用程序(通常为每1000-2000行非注释的源语句约1缺陷)数百严重缺陷。 FindBugs的是开源的,并且已被下载超过23万次,可以通过命令行、ant、eclipse、maven、netbeans、emacs等方式来使用。


简单来说,它可以帮助开发者测试出一些明显的bug,例如:缺少必要的null check、多余的null check;多余的if条件,重复的代码块;错误使用==进行条件判断,数据库连接、IO未关闭;无限递归、死锁等。还可以检测出写的不优雅的代码,像使用StringBuffer、StringBuilder代替字符串连接之类。注意:Findbugs是检查java字节码,也就是*.class文件。