This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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: 10927
    
  12

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

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: 10927
    
  12

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

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
 
Similar Threads
findbugs "no classes found" error
Finbugs & codesmell
Findbugs can't find -outputFile??
Tool to verify null check (FindBugs, CheckStyle ..)
help needed with FindBugs + Eclipse