views:

750

answers:

8

Being vaguely familiar with the Java world I was googling for a static analysis tool that would also was intelligent enough to fix the issues it finds. I ran at CodePro tool but, again, I'm new to the Java community and don't know the vendors.

What tool can you recommend based on the criteria above?

Thank you!

+8  A: 

I recommend FindBugs. http://findbugs.sourceforge.net/ Good in assisting to do code review.

zxcv
+4  A: 

IntelliJ IDEA from JetBrains. They also do ReSharper in the .Net community.

SaaS Developer
+7  A: 
Eduard Wirch
Will you please comment a bit on your use of lint4j? I just tried it, but it produced only a single warning (a false positive!) on my entire code base. I know my code isn't that clean! My code requires Java 6, and the lint4j proj. seems to be inactive. lint4j is not FOSS, so no source code. Thanks!
Greg Mattes
I got several hundred warnings from lint4j during my scan of 200 KLOC project. Most of them were "nice to have" like "use a character literal instead of String literal to append a single constant character to a stream". Findbugs definitely gives you the more important things to consider. (But on new code I always use both of them!)
Bananeweizen
+7  A: 

FindBugs, PMD and Checkstyle are all excellent choices especially if you integrate them into your build process.

At my last company we also used Fortify to check for potential security problems. We were fortunate to have an enterprise license so I don't know the cost involved.

bmatthews68
+1  A: 

Sonar is a quality control tool. It gauges quality of Java applications through the observance of coding rules conventions, metric measures and advanced indicators.

Sonar is based on the following projects :

You could also use Simian for duplication detection.

madgnome
+1  A: 

All the above are great tools. PMD is probably the most common.

Another tool is Enerjy. It recently became free, so you can download it and try for yourself. Enerjy is somewhat more organized and a better fit to larger teams. It makes it easier to customize and share the rules. Personally, I'm not a big fan, but maybe you'll fancy it more than I do.

zvikico
+1  A: 

CRAP4J is not only an awesome name but it's quite useful. The other good ones are all above, best of all (IMHO) is FindBugs, because it really does find honest-to-goodness bugs right away in a big code base.

Epaga
A: 

Couple of commercial vendors that have a Java offering:

Klocwork Coverity

They won't "fix the issues" they find (nor will, I believe, any of the other ones mentioned above) but these are all tools that have varying strengths.