1. FindBugs Introduction
FindBugs is a static analysis tool that examines a class or JAR file to compare bytecode with a set of defect patterns to identify possible problems. With the static analysis tool, you can analyze the software without actually running the program to discover many potential bugs in the middle of the code, such as referencing a null pointer (Nullpointer dereference), a specific resource (db Connection) is not closed, and so on. If you use manual checks, these bugs can be difficult to find, and may never be discovered until run-time seizures ... That's the value of FindBugs's existence.
2. FindBugs Plugin Download installation
Download the Eclipse plugin version of findbugs, copy the extracted directory to the Dropins folder under the MyEclipse installation path, and then restart the MyEclipse, as in click:
If you see the findbugs Red bug icon in perspective, the plug-in installation succeeds:
3. Start the plugin to find bugs
Switch to the package view, right-click on the project name, then select: Start the Find Bugs program, after the program runs, it will show the number of bugs found in this run after the project name.
4. Fix bugs
To open a findbugs Perspective view:
Method One: Through the menu Window--open perspective--other--findbugs
Method Two: Through the toolbar:, add, then open
As shown, double-click the hint to jump to code out for repair:
Finally: FindBugs is just a tool. As a developer, of course, the first thing to do is to try to avoid introducing bugs when programming , rather than relying on a tool to check for yourself. Each tool also has its limitations, the pre-set rules for finding bugs are not suitable for all programs, so not all bugs can be monitored by the tool, and not every bug identified needs to be resolved, whether it needs to be resolved and the programmer needs to make decisions based on the situation.
Code defect static Analysis tool FindBugs plug-in installation using plots