Summary
PMD is a static analysis tool that scans Java source code for potential problems. The latest release introduces new rules, such as a J2EE ruleset with an initial UseProperClassLoader rule, better JSP integration, including the ability to experiment with JSP rules in the rule designer GUI, and better Ant integration.
Advertisement
The PMD project released version 3.7 of its static analysis tool for Java.
PMD scans Java source code, parses that code, and then matches the parsed code tree with a set of rules. Some of PMD's built-in rules look for unused variables, unnecessary object creation, empty catch blocks, wasteful String and StringBuffer usage, overcomplicated expressions, and even code duplication (often the result of copy-and-past programming).
While PMD's built-in rules are sufficient for most users, users can extend PMD's ruleset with their own rules. PMD uses the JavaCC parser, and its Abstract Syntax Tree (AST) plugin, and parses source code into an AST tree. Thus, PMD rules can be written in Java with the JavaCC and AST APIs, and then configured to work with Ant or an IDE's source code editor. PMD is already integrated with a host of IDEs, such as IntelliJ IDEA, NetBeans, and Eclipse.
The new PMD version provides better J2EE support with a J2EE rule, UseProperClassLoader, and better JSP support with rules such as DuplicateJspImport, and the ability to experiment with JSP rules in a graphical rule designer.
Do you use PMD, or some other static analysis tool, on your code?