my dog learned polymorphism*
The moose likes Beginning Java and the fly likes FindBugs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "FindBugs" Watch "FindBugs" New topic
Author

FindBugs

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11406
    
  16

I'm not sure if this is the correct forum... if not, apologies in advance.
I'm wondering if anybody here has ever used any kind of static code analyzer. I found one called "FindBugs", and played with it for a few minutes. it found a few things (well, a lot actually), like a possible Null Pointer exceptions (it was right), and so on.
does anybody see value in these tools? does anybody incorporate them into regular builds/auto testing? I'm trying to decide how much effor i need to put into convincing my boss this is a worthwhile tool.
thanks,
fred


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
I use WSAD and that thing checks your code after every keystroke. It is constantly finding problems and warning you about stuff. It doesn't necessarily analyze the code as hardcore as what you are describling, but I can find syntax errors and the like.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Fred,
There is a testing forum further down on the page. This will probably get moved there.
I use JTest (commercial product) which does static analysis. I find it to be useful. It can point out errors that are hard to find on your own. It also helps to create cleaner code. The null pointer exceptions are actual dynamic/runtime analysis. That is another useful feature of this kind of tool. At some point we will probably incorporate it into a nightly build.
What's the website for FindBugs? Is it commercial or open source.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11406
    
  16

website for findbugs:
http://www.cs.umd.edu/~pugh/java/bugs/
it is open source.
also, believe it or not, it found a NULL POINTER exception (or a possible one) as a static analyzer. the code was not running. now it was a pretty silly mistake... something like

or some such.
thanks!! sorry for the wrong list posting!
f
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Thanks for the link. They have a paper on the site that explains how they can catch some null pointers through static analysis. It was really interesting.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FindBugs