本章將講述如何在Myeclipse下,使用FindBugs,靜態分析工具,無需開發人員費勁就能找出代碼中已有的缺陷。eclipse
一:Myeclipse下如何安裝FindBugs插件工具
1:FindBugs插件下載地址:.net
https://sourceforge.net/projects/findbugs/files/findbugs%20eclipse%20plugin/插件
本人使用的是1.3.9版本,點擊所要下載的版本連接,進入下載頁面,選擇如圖所示文件:edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821.zip blog
2:插件下載後,解壓到%Myeclipse%MyEclipse 10\dropins目錄下,重啓myeclipse便可使用。ip
二:Myeclipse下,如何使用FindBugs開發
1:打開FindBugs視圖get
進入myeclipse,選擇Window -- Show View -- Other --FindBugs ,選擇這兩個視圖,檢查出來的問題會在這兩個視圖顯示it
2:對項目使用FindBugsclass
選中項目,右鍵 -- 選擇 Find Bugs -- Find Bugs ,若項目有問題,就會羅列出來到FindBugs視圖下
三:常見問題解釋及處理
1:問題:Bug: The class name test doesn't start with an upper case letter
Pattern id: NM_CLASS_NAMING_CONVENTION, type: Nm, category: BAD_PRACTICE
緣由:該類的類型首字符應該大寫。