FindBug,Java代码的监督者

FindBugs是个相当有趣的小工具,可以分析出Java程序中常见的“坏代码”——这些代码可能是效率不彰(例如创建不必要的对象),也可能有安全性或稳定性方面的隐患(例如不恰当的同步、未关闭的文件句柄)。我用FindBugs检查了一下JUnit,发现了好几处小问题;而对J2SE 1.4.2 Runtime的检查更是发现问题一大堆。你自己的程序,是不是也该做做检查呢?
 
目前这个小玩意还只能检查.jar里的.class文件,不能不说是一点缺憾,使用起来也多少有点麻烦。你有没有兴趣给它做做加工完善呢?
 
——————————————
 
FindBugs is a program which looks for bugs in Java code. It can detect various coding "mistakes" including thread synchronization problems and misuse of API methods. It includes both Swing and command line interfaces.

The new version adds new bug detectors:

- Places where a null pointer might be dereferenced
- I/O streams that are opened, do not escape the method, and are not closed on all paths out of the method
- Methods that can return null instead of a zero-length array
- Using the == or != operators to compare String objects

Other changes in this version:

- Command line interface can save bugs as XML
- GUI can save bugs to and load bugs from XML
- An "Annotations" window in the GUI allows the user to add textual annotations to bug reports; these annotations are preserved when bugs are saved as XML
- In this release, the Japanese bug summary translations by Germano Leichsenring are really included (they were inadvertently omitted in the previous release)
- Completely rewrote the control flow graph builder, hopefully for the last time
- Simplified implementation of control flow graphs, which should reduce memory use and possibly improve performance
- Improvements to command line interface (list bug priorities, filter by priority, specify aux classpath, specify project to analyze)
- Various bug fixes and enhancements

Check out the open source FindBugs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值