FindBugs

FindBugsI ran into FindBugs sometime earlier this week, but didn’t get a chance to check it out immediately. Tonight I played with it a little bit by turning it loose on the Java Yahoo! Search Web Services SDK. It’s neat, a very simple to use application that does some sanity checking on Java code and reports back any issues it finds. It found some data integrity issues (returning references to mutable objects and storing references to mutable objects) and some possible performance issues (inner classes that could be static inner classes). I think I need a much larger project in order to really put FindBugs through the paces, but this was enough of a test to determine that it’s very easy to use.

It comes with a GUI (pictured in the screenshot) and a command line interface. I used the GUI because, hey…why not? It has a nice tree control for expanding and collapsing the “bugs” it finds. Additionally, a tabbed interface allows viewing the “bugs” by different groupings (by class, package, bug type and bug category). If you get a chance to point it at a larger project, let me know how it goes. I’m especially curious to see how it does against codebases that have glaring bugs.

2 Responses to “FindBugs”

  1. Anonymous says:

    Is it much different than Intellij IDEA’s code analysis software?

  2. Ryan says:

    That’s a good question. I ought to run the IDEA code inspector and compare the two. Although, again, I think it’s hard to really see what FindBugs can do with such a small project as the one I’m kicking it around on.

    One thing to point out is, unlike IDEA’s code inspector, FindBugs is free and open source.

Leave a Reply