Other options (raised on the Hadoop list) are Checkstyle:
http://checkstyle.sourceforge.net/
and FindBugs:
http://findbugs.sourceforge.net/
Although these are both under LGPL and thus harder to include in Apache
projects.
Anything that generates a lot of false positives is bad: it either
causes us to skip analysis of lots of files, or ignore the warnings.
Skipping the JavaCC-generated classes is reasonable, but I'm wary of
skipping much else.
Sigh.
Doug
Dawid Weiss wrote:
Ok, PMD seems like a good idea. I've added it to the build file. Unused
code detection shows a few catches (javacc-generated classes need to be
ignored because they contain a lot of junk), but unfortunately it also
displays false positives such as in:
MapWritable.java 429 {Avoid unused private fields such as
'fKeyClassId'}
This field is private but is used in an outside class (through a
synthetic accessor I presume, so a simple syntax tree analysis PMD does
is insufficient to catch it).
These things would need to be marked in the code as ignorable... Do you
want me to create a JIRA issue for this, Doug? Or should we drop the
subject? Oh, I forgot to say this: PMD's jars add a minimum of 1MB to
the codebase (Xerces can be reused).
D.