PMD 6.11.0


PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It supports Java, JavaScript, XML, XSL.

Available Plugins include:

  • Maven PMD.
  • Eclipse.
  • NetBeans.
  • JBuilder.
  • JDeveloper.
  • IntelliJ IDEA.

PMD additionally includes CPD, the copy-paste-detector. CPD finds duplicated code in Java, C, C++, C#, PHP, Ruby, Fortran, JavaScript, PLSQL, Apache Velocity, Scala, Objective C, Matlab, Python, Go.

檔案版本 PMD 6.11.0
檔案大小 43.91MB
系統 Windows (All Versions)
支援語系 Multiple languages
軟體類型 開源軟體
更新日期 2019-01-29

This is a minor release.

New and noteworthy:
Updated Apex Support.
The Apex language support has been bumped to version 45 (Spring '19). All new language features are now properly parsed and processed.
Many nodes now expose more informations, such as the operator for BooleanExpressions. This makes these operators consumable by XPath rules, e.g. //BooleanExpression[@Operator='&&'].

PL/SQL Grammar improvements:
In this release, many parser bugs in our PL/SQL support have been fixed. This adds e.g. support for table collection expressions (SELECT * FROM TABLE(expr)).
Support for parsing insert statements has been added.
More improvements are planned for the next release of PMD.

New Rules:
The new Java rule UnsynchronizedStaticFormatter (java-multithreading) detects unsynchronized usages of static java.text.Format instances. This rule is a more generic replacement of the rule UnsynchronizedStaticDateFormatter which focused just on DateFormat.
The new Java rule ForLoopVariableCount (java-bestpractices) checks for the number of control variables in a for-loop. Having a lot of control variables makes it harder to understand what the loop does. The maximum allowed number of variables is by default 1 and can be configured by a property.
The new Java rule AvoidReassigningLoopVariables (java-bestpractices) searches for loop variables that are reassigned. Changing the loop variables additionally to the loop itself can lead to hard-to-find bugs.
The new Java rule UseDiamondOperator (java-codestyle) looks for constructor calls with explicit type parameters. Since Java 1.7, these type parameters are not necessary anymore, as they can be inferred now.

Modified Rules:
The Java rule LocalVariableCouldBeFinal (java-codestyle) has a new property ignoreForEachDecl, which is by default disabled. The new property allows for ignoring non-final loop variables in a for-each statement.

Deprecated Rules:
The Java rule UnsynchronizedStaticDateFormatter has been deprecated and will be removed with PMD 7.0.0. The rule is replaced by the more general UnsynchronizedStaticFormatter.

Fixed Issues:

CPD results not consistent between runs.
Refactor metrics to be dealt with generically from pmd-core.

Include the documentation category.
PMD parsing exception for Apex classes using 'inherited sharing' keyword.
AST node attribute @Image not usable / always null in XPath rule / Designer.

Default methods should not be considered abstract.
Private field is detected as public inside nested classes in interfaces.
OneDeclarationPerLine: False positive for loops.
New rule: AvoidReassigningLoopVariable.
New rule: ForLoopVariableCount.
LocalVariableCouldBeFinal: allow excluding the variable in a for-each loop.
New Rule: UseDiamondOperator.
ReturnFromFinallyBlock: False positive on lambda expression in finally block.
NPE in PMD 6.8.0 InvalidSlf4jMessageFormat.
New rule: UnsynchronizedStaticFormatter.

Parse Exception when using '||' operator in where clause.
Parse Exception when using SELECT COUNT(*)
Parse Exception with OUTER/INNER Joins.
Parse Exception with IS NOT NULL.
ParseException when using TableCollectionExpression.
Update Set Clause should allow multiple columns.
Parse Exception when functions are used with LIKE.
Parse Exception with function calls in WHERE clause.

API Changes
StatisticalRule and the related helper classes and base rule classes are deprecated for removal in 7.0.0. This includes all of net.sourceforge.pmd.stat and net.sourceforge.pmd.lang.rule.stat, and also AbstractStatisticalJavaRule, AbstractStatisticalApexRule and the like. The methods Report#addMetric and metricAdded will also be removed.
setProperty is deprecated, because MultiValuePropertyDescriptor is deprecated as well.

External Contributions
[java] Fix for ReturnFromFinallyBlock false-positives.
[java] LocalVariableCouldBeFinal: allow excluding the variable in a for-each loop.
[java] OneDeclarationPerLine: Don't report multiple variables in a for statement.
[java] New rule: ForLoopVariableCount: check the number of control variables in a for loop.
[java] Upgrade to ASM7 for JDK 11 support.
[java] New rule: AvoidReassigningLoopVariables.
[java] This is the change regarding the usediamondoperator.
[doc] fixing dead links + tool to check for dead links automatically.
[java] InvalidSlf4jMessageFormatRule should not throw NPE for enums.
[core] Upgrading Google Gson from 2.5 to 2.8.5
[core] Upgrading System Rules dependency from 1.8.0 to 1.19.0
[plsql] updates should allow for multiple statements.
[core] Fixes 1196: inconsistencies of clones returned by different CPD executions for the same files.

作者 PMD
官網 暫無資訊