PMD

PMD scans Java source code and looks for potential problems like:

  • Empty try/catch/finally/switch blocks
  • Unused local variables, parameters and private methods
  • Empty if/while statements
  • Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
  • Classes with high Cyclomatic Complexity measurements

PMD has plugins for JDeveloper, Eclipse, JEdit, JBuilder, Omnicore's CodeGuide, NetBeans/Sun ONE Studio, IntelliJ IDEA, TextPad, Maven, Ant, Gel, JCreator, and Emacs. You can download everything from here.