FindBug,Java程式碼的監督者 (轉)

gugu99發表於2007-08-16
FindBug,Java程式碼的監督者 (轉)[@more@]Finugs是個相當有趣的,可以分析出中常見的“壞程式碼”——這些程式碼可能是不彰(例如建立不必要的),也可能有性或穩定性方面的隱患(例如不恰當的同步、未關閉的控制程式碼)。我用Finds檢查了一下JUnit,發現了好幾處小問題;而對 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 methods. It includes both 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 s

Other changes in this version:

- Command line interface can save bugs as
- 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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10748419/viewspace-960701/,如需轉載,請註明出處,否則將追究法律責任。

相關文章