PMD v6.25.0 Release Notes
Release Date: 2020-06-27 // almost 4 years ago-
27-June-2020 - 6.25.0
The PMD team is pleased to announce PMD 6.25.0.
๐ This is a minor release.
Table Of Contents
๐ New and noteworthy
Scala cross compilation
0๏ธโฃ Up until now the PMD Scala module has been compiled against scala 2.13 only by default.
However, this makes it impossible to use pmd as a library in scala projects,
๐ that use scala 2.12, e.g. in sbt plugins. Therefore PMD now provides cross compiled pmd-scala
modules for both versions: scala 2.12 and scala 2.13.The new modules have new maven artifactIds. The old artifactId
net.sourceforge.pmd:pmd-scala:6.25.0
๐ is still available, but is deprecated from now on. It has been demoted to be just a delegation to the new
๐pmd-scala_2.13
module and will be removed eventually.The coordinates for the new modules are:
<dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-scala_2.12</artifactId> <version>6.25.0</version> </dependency> <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-scala_2.13</artifactId> <version>6.25.0</version> </dependency>
The command line version of PMD continues to use scala 2.13.
๐ New Rules
The new Java Rule
UnnecessaryCast
(java-codestyle
)
finds casts that are unnecessary while accessing collection elements.The new Java Rule
AvoidCalendarDateCreation
(java-performance
)
finds usages ofjava.util.Calendar
whose purpose is just to get the current date. This
can be done in a more lightweight way.The new Java Rule
UseIOStreamsWithApacheCommonsFileItem
(java-performance
)
finds usage ofFileItem.get()
andFileItem.getString()
. These two methods are problematic since
they load the whole uploaded file into memory.Modified rules
The Java rule
UseDiamondOperator
(java-codestyle
) now by default
finds unnecessary usages of type parameters, which are nested, involve wildcards and are used
within a ternary operator. These usages are usually only unnecessary with Java8 and later, when
the type inference in Java has been improved.In order to avoid false positives when checking Java7 only code, the rule has the new property
0๏ธโฃjava7Compatibility
, which is disabled by default. Settings this to "true" retains
the old rule behaviour.๐ Fixed Issues
- apex-bestpractices
- #2554: [apex] Exception applying rule UnusedLocalVariable on trigger
- core
- #971: [apex][plsql][java] Deprecate overly specific base rule classes
- #2451: [core] Deprecate support for List attributes with XPath 2.0
- #2599: [core] Fix XPath 2.0 Rule Chain Analyzer with Unions
- #2483: [lang-test] Support cpd tests based on text comparison.
๐ For details see
๐ Testing your implementation
๐ in the developer documentation.
- c#
- #2551: [c#] CPD suppression with comments doesn't work
- cpp
- #1757: [cpp] Support unicode characters
- java
- #2549: [java] Auxclasspath in PMD CLI does not support relative file path
- ๐ java-codestyle
- java-design
- java-errorprone
- #2544: [java] UseProperClassLoader can not detect the case with method call on intermediate variable
- ๐ java-performance
- scala
- #2547: [scala] Add cross compilation for scala 2.12 and 2.13
API Changes
๐ The maven module
net.sourceforge.pmd:pmd-scala
is deprecated. Usenet.sourceforge.pmd:pmd-scala_2.13
ornet.sourceforge.pmd:pmd-scala_2.12
instead.Rule implementation classes are internal API and should not be used by clients directly.
The rules should only be referenced via their entry in the corresponding category ruleset
(e.g.<rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" />
).๐ While we definitely won't move or rename the rule classes in PMD 6.x, we might consider changes
in PMD 7.0.0 and onwards.๐ Deprecated APIs
Internal API
๐ Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
๐ You can identify them with the@InternalApi
annotation. You'll also get a deprecation warning.- ๐
AbstractIgnoredAnnotationRule
(Java) - ๐
AbstractInefficientZeroCheck
(Java) - ๐
AbstractJUnitRule
(Java) - ๐
AbstractJavaMetricsRule
(Java) - ๐
AbstractLombokAwareRule
(Java) - ๐
AbstractPoorMethodCall
(Java) - ๐
AbstractSunSecureRule
(Java) - ๐
AbstractNcssCountRule
(Java) - ๐
AbstractCommentRule
(Java) - ๐
AbstractOptimizationRule
(Java) - ๐
RegexHelper
(Java) - โ
AbstractApexUnitTestRule
(Apex) - ๐
AbstractNcssCountRule
(Apex) - ๐
AbstractNcssCountRule
(PLSQL) - ๐
ApexParser
- ๐
ApexHandler
- ๐
RuleChain
- ๐
RuleSets
- ๐
RulesetsFactoryUtils#getRuleSets
For removal
- ๐
TokenEntry#TokenEntry
- โ
AbstractTokenizerTest
. Use CpdTextComparisonTest in module pmd-lang-test instead.
๐ For details see
๐ Testing your implementation
๐ in the developer documentation. - ๐
ASTAnnotation#suppresses
(Apex) - ๐
ApexXPathRule
(Apex) - โ
SymbolTableTestRule
(Java) - ๐
InefficientStringBufferingRule#isInStringBufferOperation
External Contributions
- ๐ #1932: [java] Added 4 performance rules originating from PMD-jPinpoint-rules - Jeroen Borgers
- โก๏ธ #2349: [java] Optimize UnusedPrivateMethodRule - shilko2013
- #2547: [scala] Add cross compilation for scala 2.12 and 2.13 - Joรฃo Ferreira
- #2567: [c#] Fix CPD suppression with comments doesn't work - Lixon Lookose
- ๐ฆ #2573: [java] DefaultPackage: Allow package default JUnit 5 Test methods - Craig Andrews
- #2593: [java] NPathComplexity should mention the expected NPath complexity - Artem Krosheninnikov
Stats
- 135 commits
- 31 closed tickets & PRs
- ๐ Days since last release: 33
- apex-bestpractices