Changelog History
Page 1
-
v6.29.0 Changes
October 24, 202024-October-2020 - 6.29.0
The PMD team is pleased to announce PMD 6.29.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
β‘οΈ Updated Apex Support
- π The Apex language support has been bumped to version 50 (Winter '21). All new language features are now properly
parsed and processed. Especially the Safe Navigation Operator is now supported.
π See also Salesforce Winter '21 Release Notes
π New Rules
- The new Apex rule
OperationWithLimitsInLoop
(apex-performance
)
finds operations in loops that may hit governor limits such as DML operations, SOQL
queries and more. The rule replaces the three rules "AvoidDmlStatementsInLoops", "AvoidSoqlInLoops",
and "AvoidSoslInLoops".
π Renamed Rules
- The Java rule
DoNotCallSystemExit
has been renamed to
DoNotTerminateVM
, since it checks for all the following calls:
System.exit(int)
,Runtime.exit(int)
,Runtime.halt(int)
. All these calls terminate
the Java VM, which is bad, if the VM runs an application server which many independent applications.
π Deprecated Rules
- The Apex rules
AvoidDmlStatementsInLoops
,
AvoidSoqlInLoops
andAvoidSoslInLoops
π (apex-performance
) are deprecated in favour of the new rule
OperationWithLimitsInLoop
. The deprecated rules will be removed
with PMD 7.0.0.
π Fixed Issues
- apex
- #2839: [apex] Apex classes with safe navigation operator from Winter 21 (50.0) are skipped
- π apex-performance
- #1713: [apex] Mark Database DML statements in For Loop
- core
- #2831: [core] Fix XMLRenderer newlines when running under IBM Java
- java-errorprone
- miscellaneous
- #2823: [doc] Renamed/Moved rules are missing in documentation
- vf (Salesforce VisualForce)
- #2765: [vf] Attributes with dot cause a VfParseException
External Contributions
- π #2803: [java] Improve DoNotCallSystemExit (Fixes #2157) - Vitaly Polonetsky
- π #2809: [java] Move test config from file to test class - Stefan Birkner
- π #2810: [core] Move method "renderTempFile" to XMLRendererTest - Stefan Birkner
- #2811: [java] CloseResource - Fix #2764: False-negative when re-assigning variable - Andi Pabst
- #2813: [core] Use JUnit's TemporaryFolder rule - Stefan Birkner
- #2816: [apex] Detect 'Database' method invocations inside loops - Jeff Bartolotta
- #2829: [doc] Small correction in pmd_report_formats.md - Gustavo Krieger
- #2834: [vf] Allow attributes with dot in Visualforce - rmohan20
- #2842: [core] Bump antlr4 from 4.7 to 4.7.2 - Adrien Lecharpentier
- β‘οΈ #2865: [java] (doc) Update ExcessiveImports example code for clarity - Gustavo Krieger
- #2866: [java] (doc) Fix example for CouplingBetweenObjects - Gustavo Krieger
Stats
- 50 commits
- 23 closed tickets & PRs
- π Days since last release: 27
- π The Apex language support has been bumped to version 50 (Winter '21). All new language features are now properly
-
v6.28.0 Changes
September 26, 202026-September-2020 - 6.28.0
The PMD team is pleased to announce PMD 6.28.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
CPD's AnyTokenizer has been improved
The AnyTokenizer is used for languages, that don't have an own lexer/grammar based tokenizer.
π AnyTokenizer now handles string literals and end-of-line comments. Fortran, Perl and Ruby have
β‘οΈ been updated to use AnyTokenizer instead of their old custom tokenizer based on AbstractTokenizer.
π See #2758 for details.π AbstractTokenizer and the custom tokenizers of Fortran, Perl and Ruby are deprecated now.
π Fixed Issues
cpd
- #2758: [cpd] Improve AnyTokenizer
- #2760: [cpd] AnyTokenizer doesn't count columns correctly
π apex-security
- #2774: [apex] ApexSharingViolations does not correlate sharing settings with class that contains data access
java
- #2738: [java] Custom rule with @ExhaustiveEnumSwitch throws NPE
- #2755: [java] [6.27.0] Exception applying rule CloseResource on file ... java.lang.NullPointerException
- #2756: [java] TypeTestUtil fails with NPE for anonymous class
- #2767: [java] IndexOutOfBoundsException when parsing an initializer BlockStatement
- #2783: [java] Error while parsing with lambda of custom interface
java-bestpractices
- #2759: [java] False positive in UnusedAssignment
java-design
- #2708: [java] False positive FinalFieldCouldBeStatic when using lombok Builder.Default
API Changes
π Deprecated API
For removal
- 0οΈβ£
net.sourceforge.pmd.RuleViolationComparator
. UseRuleViolation#DEFAULT_COMPARATOR
instead. - π
net.sourceforge.pmd.cpd.AbstractTokenizer
. Usenet.sourceforge.pmd.cpd.AnyTokenizer
instead. - π
net.sourceforge.pmd.cpd.FortranTokenizer
. Was replaced by anAnyTokenizer
. UseFortranLanguage#getTokenizer
anyway. - π
net.sourceforge.pmd.cpd.PerlTokenizer
. Was replaced by anAnyTokenizer
. UsePerlLanguage#getTokenizer
anyway. - π
net.sourceforge.pmd.cpd.RubyTokenizer
. Was replaced by anAnyTokenizer
. UseRubyLanguage#getTokenizer
anyway. - π
RuleReference#getOverriddenLanguage
and
πRuleReference#setLanguage
- Antlr4 generated lexers:
net.sourceforge.pmd.lang.cs.antlr4.CSharpLexer
will be moved to packagenet.sourceforge.pmd.lang.cs.ast
with PMD 7.net.sourceforge.pmd.lang.dart.antlr4.Dart2Lexer
will be renamed toDartLexer
and moved to package
π¦net.sourceforge.pmd.lang.dart.ast
with PMD 7. All other classes in the old package will be removed.net.sourceforge.pmd.lang.go.antlr4.GolangLexer
will be moved to package
π¦net.sourceforge.pmd.lang.go.ast
with PMD 7. All other classes in the old package will be removed.net.sourceforge.pmd.lang.kotlin.antlr4.Kotlin
will be renamed toKotlinLexer
and moved to package
net.sourceforge.pmd.lang.kotlin.ast
with PMD 7.net.sourceforge.pmd.lang.lua.antlr4.LuaLexer
will be moved to package
π¦net.sourceforge.pmd.lang.lua.ast
with PMD 7. All other classes in the old package will be removed.
External Contributions
- #2735: [ci] Add github actions for a fast view of pr succeed/not - XenoAmess
- π #2747: [java] Don't trigger FinalFieldCouldBeStatic when field is annotated with lombok @Builder.Default - Ollie Abbey
- 0οΈβ£ #2773: [java] issue-2738: Adding null check to avoid npe when switch case is default - Nimit Patel
- π #2789: Add badge for reproducible build - Dan Rollo
- #2791: [apex] Analyze inner classes for sharing violations - Jeff Bartolotta
Stats
- 58 commits
- 24 closed tickets & PRs
- π Days since last release: 25
-
v6.27.0 Changes
August 31, 202031-August-2020 - 6.27.0
The PMD team is pleased to announce PMD 6.27.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
π Java 15 Support
π This release of PMD brings support for Java 15. PMD can parse Text Blocks
which have been promoted to be a standard language feature of Java.π PMD also supports Pattern Matching for instanceof,
Records, and Sealed Classes.Note: The Pattern Matching for instanceof, Records, and Sealed Classes are all preview language features of OpenJDK 15
0οΈβ£ and are not enabled by default. In order to
analyze a project with PMD that uses these language features, you'll need to enable it via the environment
variablePMD_JAVA_OPTS
and select the new language version15-preview
:export PMD_JAVA_OPTS=--enable-preview ./run.sh pmd -language java -version 15-preview ...
π Note: Support for Java 13 preview language features have been removed. The version "13-preview" is no longer available.
π Changes in how tab characters are handled
In the past, tab characters in source files has been handled differently in different languages by PMD.
For instance in Java, tab characters had a width of 8 columns, while C# used only 1 column. Visualforce instead
π used 4 columns.This has been unified now so that tab characters are consistently now always 1 column wide.
This however might be a incompatible change, if you're using the properties "BeginColumn" or "EndColumn"
β additionally to "BeginLine" and "EndLine" of a Token/AST node in order to highlight
where a rule violation occurred in the source file. If you have logic there that deals with tab characters,
π you most likely can remove this logic now, since tab characters are now just "normal" characters
in terms of string processing.π See also [all] Ensure PMD/CPD uses tab width of 1 for tabs consistently #2656.
β‘οΈ Updated PMD Designer
π This PMD release ships a new version of the pmd-designer.
π For the changes, see PMD Designer Changelog.π New Rules
- The new Java rule
AvoidReassigningCatchVariables
(java-bestpractices
) finds
π» cases where the variable of the caught exception is reassigned. This practice is surprising and prevents
further evolution of the code like multi-catch.
Modified Rules
The Java rule
CloseResource
(java-errorprone
) has a new property
closeNotInFinally
. With this property set totrue
the rule will also find calls to close a
resource, which are not in a finally-block of a try-statement. If a resource is not closed within a
finally block, it might not be closed at all in case of exceptions.0οΈβ£ As this new detection would yield many new violations, it is disabled by default. It might be
enabled in a later version of PMD.π Deprecated Rules
- The Java rule
DataflowAnomalyAnalysis
(java-errorprone
)
is deprecated in favour ofUnusedAssignment
(java-bestpractices
),
which was introduced in PMD 6.26.0.
π Fixed Issues
- core
- java
- #2646: [java] Support JDK 15
- java-bestpractices
- #2471: [java] New Rule: AvoidReassigningCatchVariables
- #2663: [java] NoClassDefFoundError on upgrade from 6.25.0 to 6.26.0
- #2668: [java] UnusedAssignment false positives
- #2673: [java] UnusedPrivateField and SingularField false positive with lombok annotation EqualsAndHashCode
- #2684: [java] UnusedAssignment FP in try/catch
- #2686: [java] UnusedAssignment must not flag abstract method parameters in interfaces and abstract classes
- java-design
- java-errorprone
- #2264: [java] SuspiciousEqualsMethodName: Improve description about error-prone overloading of equals()
- #2410: [java] ProperCloneImplementation not valid for final class
- #2431: [java] InvalidLogMessageFormatRule throws IndexOutOfBoundsException when only logging exception message
- #2439: [java] AvoidCatchingThrowable can not detect the case: catch (java.lang.Throwable t)
- #2470: [java] CloseResource false positive when resource included in return value
- #2531: [java] UnnecessaryCaseChange can not detect the case like: foo.equals(bar.toLowerCase())
- #2647: [java] Deprecate rule DataFlowAnomalyAnalysis
- π java-performance
- dart
- #2750: [dart] [cpd] Cpd Dart escaped dollar
API Changes
- XML rule definition in rulesets: In PMD 7, the
language
attribute will be required on allrule
elements that declare a new rule. Some base rule classes set the language implicitly in their
constructor, and so this is not required in all cases for the rule to work. But this
behavior will be discontinued in PMD 7, so missinglanguage
attributes are now
β reported as a forward compatibility warning.
π Deprecated API
For removal
π
AbstractParser
π
RuleContext#removeAttribute
π
ApexParserOptions
π
ASTThrowStatement#getFirstClassOrInterfaceTypeImage
π
EcmascriptXPathRule
π
XmlParserOptions
π
XmlXPathRule
π Properties of
AbstractXmlRule
π
net.sourceforge.pmd.Report.ReadableDuration
π Many methods of
net.sourceforge.pmd.Report
. They are replaced by accessors
π that produce a List. For example,iterator()
π (and implementing Iterable) andisEmpty()
are both
π replaced bygetViolations()
.π The dataflow codebase is deprecated for removal in PMD 7. This
π¦ includes all code in the following packages, and their subpackages:- and the class
PLSQLDataFlowHandler
π
VfSimpleCharStream
π
ASTJspDeclarations
π
ASTJspDocument
π
ScalaParserVisitorAdapter#zero
π
ScalaParserVisitorAdapter#combine
π
ApexParserVisitorReducedAdapter
π
JavaParserVisitorReducedAdapter
π
TypeHelper
is deprecated in
β favor ofTypeTestUtil
, which has the
same functionality, but a slightly changed API.π¦ Many of the classes in
net.sourceforge.pmd.lang.java.symboltable
π are deprecated as internal API.External Contributions
- #2656: [all] Ensure PMD/CPD uses tab width of 1 for tabs consistently - Maikel Steneker
- #2659: [java] StringToString can not detect the case: getStringMethod().toString() - Mykhailo Palahuta
- #2662: [java] UnnecessaryCaseChange can not detect the case like: foo.equals(bar.toLowerCase()) - Mykhailo Palahuta
- #2671: [java] CloseResource false positive when resource included in return value - Mykhailo Palahuta
- #2674: [java] add lombok.EqualsAndHashCode in AbstractLombokAwareRule - berkam
- #2677: [java] RedundantFieldInitializer can not detect a special case for char initialize:
char foo = '\0';
- Mykhailo Palahuta - #2678: [java] AvoidCatchingThrowable can not detect the case: catch (java.lang.Throwable t) - Mykhailo Palahuta
- π² #2679: [java] InvalidLogMessageFormatRule throws IndexOutOfBoundsException when only logging exception message - Mykhailo Palahuta
- #2682: [java] New Rule: AvoidReassigningCatchVariables - Mykhailo Palahuta
- #2697: [java] ExcessiveParameterListRule must ignore a private constructor - Mykhailo Palahuta
- π― #2699: [java] ProperCloneImplementation not valid for final class - Mykhailo Palahuta
- #2700: [java] Fix OnlyOneReturn code example - Jan-Lukas Else
- π #2722: [doc] [java] ImmutableField: extend description, fixes #2108 - Mateusz Stefanski
- β‘οΈ #2723: [doc] [java] SimplifyStartsWith: update description and example, fixes #1868 - Mateusz Stefanski
- β‘οΈ #2724: [doc] [java] SuspiciousEqualsMethodName: update description, fixes #2264 - Mateusz Stefanski
- π #2725: Cleanup: change valueOf to parse when we need primitive return value. - XenoAmess
- #2726: Cleanup: replace StringBuffer with StringBuilder - XenoAmess
- #2727: Cleanup: replace indexOf() < 0 with contains - XenoAmess
- #2728: Cleanup: javadoc issues - XenoAmess
- π¨ #2729: Cleanup: use print instead of printf if no format exists - XenoAmess
- #2730: Cleanup: StringBuilder issues - XenoAmess
- #2731: Cleanup: avoid compiling Patterns repeatedly - XenoAmess
- #2732: Cleanup: use StandardCharsets instead of Charset.forName - XenoAmess
- #2733: Cleanup: Collection::addAll issues - XenoAmess
- #2734: Cleanup: use try with resources - XenoAmess
- βοΈ #2744: Cleanup: fix typos - XenoAmess
- π #2745: [core] Fix a NPE in buildUsageText - XenoAmess
- #2749: [dart] [cpd] Improvements for Dart interpolated strings - Maikel Steneker
- #2750: [dart] [cpd] Cpd Dart escaped dollar - Maikel Steneker
Stats
- 189 commits
- 68 closed tickets & PRs
- π Days since last release: 37
- The new Java rule
-
v6.26.0 Changes
July 25, 202025-July-2020 - 6.26.0
The PMD team is pleased to announce PMD 6.26.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
π New Rules
- The new Java rule
UnusedAssignment
(java-bestpractices
) finds assignments
to variables, that are never used and are useless. The new rule is supposed to entirely replace
DataflowAnomalyAnalysis
.
Modified rules
- The Java rule
ArrayIsStoredDirectly
(java-bestpractices
) now ignores
βͺ by default private methods and constructors. You can restore the old behavior by setting the new property
allowPrivate
to "false".
π Fixed Issues
- apex
- #2610: [apex] Support top-level enums in rules
- apex-bestpractices
- #2626: [apex] UnusedLocalVariable - false positive on case insensitivity allowed in Apex
- π apex-performance
- #2598: [apex] AvoidSoqlInLoops false positive for SOQL with in For-Loop
- π apex-security
- #2620: [visualforce] False positive on VfUnescapeEl with new Message Channel feature
- core
- java-bestpractices
- π
java-codestyle
- #2546: [java] DuplicateImports reported for the same import... and import static...
- java-design
- #2174: [java] LawOfDemeter: False positive with 'this' pointer
- #2181: [java] LawOfDemeter: False positive with indexed array access
- #2189: [java] LawOfDemeter: False positive when casting to derived class
- #2580: [java] AvoidThrowingNullPointerException marks all NullPointerException objects as wrong, whether or not thrown
- #2625: [java] NPathComplexity can't handle switch expressions
- java-errorprone
- π java-performance
API Changes
π Deprecated API
For removal
- π
RuleChainVisitor
and all implementations in language modules - π
AbstractRuleChainVisitor
- π
Language#getRuleChainVisitorClass
- π
BaseLanguageModule#<init>
- π
ImportWrapper
External Contributions
- #2558: [java] Fix issue #1736 and issue #2207 - Young Chan
- #2560: [java] Fix false positives of LawOfDemeter: this and cast expressions - xioayuge
- β‘οΈ #2590: Update libraries snyk is referring to as
unsafe
- Artem Krosheninnikov - β‘οΈ #2597: [dependencies] Fix issue #2594, update exec-maven-plugin everywhere - Artem Krosheninnikov
- #2621: [visualforce] add new safe resource for VfUnescapeEl - Peter Chittum
- π― #2640: [java] NullPointerException in rule ProperCloneImplementation - Mykhailo Palahuta
- #2641: [java] AvoidThrowingNullPointerException marks all NullPointerException⦠- Mykhailo Palahuta
- #2643: [java] AvoidCallingFinalize detects some false positives (2578) - Mykhailo Palahuta
- #2651: [java] False negative: LiteralsFirstInComparisons for methods... (2569) - Mykhailo Palahuta
- #2652: [java] UseCollectionIsEmpty can not detect the case this.foo.size() - Mykhailo Palahuta
Stats
- 156 commits
- 43 closed tickets & PRs
- π Days since last release: 28
- The new Java rule
-
v6.25.0 Changes
June 27, 202027-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
-
v6.24.0 Changes
May 24, 202024-May-2020 - 6.24.0
The PMD team is pleased to announce PMD 6.24.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
π CPD now supports XML as well
Thanks to Fernando Cosso CPD can now find duplicates in XML files as well.
This is useful to find duplicated sections in XML files.β‘οΈ Updated PMD Designer
π This PMD release ships a new version of the pmd-designer.
π For the changes, see PMD Designer Changelog.π New Rules
The new Java Rule
LiteralsFirstInComparisons
(java-bestpractices
)
find String literals, that are used in comparisons and are not positioned first. Using the String literal
as the receiver of e.g.equals
helps to avoid NullPointerExceptions.This rule is replacing the two old rules
PositionLiteralsFirstInComparisons
andPositionLiteralsFirstInCaseInsensitiveComparisons
and extends the check
for the methodscompareTo
,compareToIgnoreCase
andcontentEquals
in addition toequals
and
equalsIgnoreCase
.Note: This rule also replaces the two mentioned rules in Java's quickstart ruleset.
π Deprecated Rules
- The two Java rules
PositionLiteralsFirstInComparisons
andPositionLiteralsFirstInCaseInsensitiveComparisons
have been deprecated
in favor of the new ruleLiteralsFirstInComparisons
.
π Fixed Issues
- apex-bestpractices
- #2468: [apex] Unused Local Variable fails on blocks
- core
- c#
- #2495: [c#] Support for interpolated verbatim strings
- java
- #2472: [java] JavaCharStream throws an Error on invalid escape
- java-bestpractices
- #2145: [java] Deprecate rules PositionLiteralsFirstIn(CaseInsensitive)Comparisons in favor of LiteralsFirstInComparisons
- #2288: [java] JUnitTestsShouldIncludeAssert: Add support for Hamcrest MatcherAssert.assertThat
- #2437: [java] AvoidPrintStackTrace can't detect the case e.getCause().printStackTrace()
- π
java-codestyle
- #2476: [java] MethodNamingConventions - Add support for JUnit 5 method naming
- java-errorprone
- #2477: [java] JUnitSpelling false-positive for JUnit5/4 tests
- swift
- #2473: [swift] Swift 5 (up to 5.2) support for CPD
API Changes
π Deprecated APIs
- π
BaseLanguageModule#addVersion(String, LanguageVersionHandler, boolean)
- π Some members of
TokenMgrError
, in particular, a new constructor is available
that should be preferred to the old ones - π
AntlrTokenManager.ANTLRSyntaxError
Experimental APIs
Note: Experimental APIs are identified with the annotation
Experimental
,
π see its javadoc for details- π The experimental methods in
BaseLanguageModule
have been replaced by a
definitive API.
External Contributions
- β‘οΈ #2446: [core] Update maven-compiler-plugin to 3.8.1 - Artem Krosheninnikov
- #2448: [java] Operator Wrap check - Harsh Kukreja
- #2449: [plsql] Additional info in SqlStatement, FormalParameter and FetchStatement - Grzegorz Sudolski
- #2452: [doc] Fix "Making Rulesets" doc sample code indentation - Artur Dryomov
- π #2457: [xml] Adding XML to CPD supported languages - Fernando Cosso
- β¬οΈ #2465: [dependencies] Upgrade hamcrest, mockito and JUnit - Artem Krosheninnikov
- #2469: [apex] fix false positive unused variable if only a method is called - Gwilym Kuiper
- π #2475: [swift] Swift 4.2-5.2 support - kenji21
- π #2476: [java] MethodNamingConventions - Add support for JUnit 5 method naming - Bruno Ritz
- #2478: [java] New rule: LiteralsFirstInComparisons - John-Teng
- #2479: [java] False positive with Hamcrest's assertThat - andreoss
- #2481: [java] Fix JUnitSpellingRule false positive - Artem Krosheninnikov
- π #2493: [java] Deprecate redundant String Comparison rules - John-Teng
- π #2495: [c#] Support for interpolated verbatim strings - Maikel Steneker
Stats
- 114 commits
- 29 closed tickets & PRs
- π Days since last release: 30
- The two Java rules
-
v6.23.0 Changes
April 24, 202024-April-2020 - 6.23.0
The PMD team is pleased to announce PMD 6.23.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
PMD adopts Contributor Code of Conduct
To facilitate healthy and constructive community behavior PMD adopts
Contributor Convenant as its code of
conduct.π Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.You can find the code of conduct in the file code_of_conduct.md
in our repository.π Performance improvements for XPath 2.0 rules
π XPath rules written with XPath 2.0 now support conversion to a rulechain rule, which
π improves their performance. The rulechain is a mechanism that allows several rules
to be executed in a single tree traversal. Conversion to the rulechain is possible if
your XPath expression looks like//someNode/... | //someOtherNode/... | ...
, that
is, a union of one or more path expressions that start with//
. Instead of traversing
the whole tree once per path expression (and per rule), a single traversal executes all
rules in your ruleset as needed.This conversion is performed automatically and cannot be disabled. The conversion should
not change the result of your rules , if it does, please report a bug at https://github.com/pmd/pmd/issuesπ Note that XPath 1.0 support, the default XPath version, is deprecated since PMD 6.22.0.
β¬οΈ We highly recommend that you upgrade your rules to XPath 2.0. Please refer to the migration guide.Javascript improvements for ES6
π PMD uses the Rhino library to parse Javascript.
0οΈβ£ The default version has been set toES6
, so that some ECMAScript 2015 features are
π supported. E.g.let
statements andfor-of
loops are now parsed. However Rhino does
π not support all features.π New JSON renderer
π PMD now supports a JSON renderer (use it with
-f json
on the CLI).
π See the documentation and exampleπ New Rules
The new Apex rule
FieldDeclarationsShouldBeAtStart
(apex-codestyle
)
helps to ensure that field declarations are always at the beginning of a class.The new Apex rule
UnusedLocalVariable
(apex-bestpractices
) detects unused
local variables.π Fixed Issues
- apex-design
- #2358: [apex] Invalid Apex in Cognitive Complexity tests
- π apex-security
- core
- doc
- java
- #2378: [java] AbstractJUnitRule has bad performance on large code bases
- java-bestpractices
- #2398: [java] AbstractClassWithoutAbstractMethod false negative with inner abstract classes
- π java-codestyle
- java-design
- #2390: [java] AbstractClassWithoutAnyMethod: missing violation for nested classes
- java-errorprone
- #2402: [java] CloseResource possible false positive with Primitive Streams
- java-multithreading
- #2313: [java] Documenation for DoNotUseThreads is outdated
- javascript
- javascript-errorprone
- #384: [javascript] Trailing commas not detected on French default locale
API Changes
π 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.- π
AbstractXPathRuleQuery
- π
JaxenXPathRuleQuery
- π
SaxonXPathRuleQuery
- π
XPathRuleQuery
In ASTs
As part of the changes we'd like to do to AST classes for 7.0.0, we would like to
hide some methods and constructors that rule writers should not have access to.
The following usages are now deprecated in the Apex , Javascript , PL/SQL , Scala and Visualforce ASTs:- π Manual instantiation of nodes. Constructors of node classes are deprecated and
π markedInternalApi
. Nodes should only be obtained from the parser,
which for rules, means that they never need to instantiate node themselves.
π¦ Those constructors will be made package private with 7.0.0. - Subclassing of abstract node classes, or usage of their type. The base classes are internal API
and will be hidden in version 7.0.0. You should not couple your code to them. - Setters found in any node class or interface. Rules should consider the AST immutable.
π¦ We will make those setters package private with 7.0.0. - π The implementation classes of
Parser
(egVfParser
) are deprecated and should not be used directly.
π UseLanguageVersionHandler#getParser
instead. - π The implementation classes of
TokenManager
(egVfTokenManager
) are deprecated and should not be used outside of our implementation.
This also affects CPD-only modules.
π These deprecations are added to the following language modules in this release.
π Please look at the package documentation to find out the full list of deprecations.- π¦ Apex:
net.sourceforge.pmd.lang.apex.ast
- π¦ Javascript:
net.sourceforge.pmd.lang.ecmascript.ast
- π¦ PL/SQL:
net.sourceforge.pmd.lang.plsql.ast
- π¦ Scala:
net.sourceforge.pmd.lang.scala.ast
- π¦ Visualforce:
net.sourceforge.pmd.lang.vf.ast
π These deprecations have already been rolled out in a previous version for the
following languages:- π¦ Java:
net.sourceforge.pmd.lang.java.ast
- π¦ Java Server Pages:
net.sourceforge.pmd.lang.jsp.ast
- π¦ Velocity Template Language:
net.sourceforge.pmd.lang.vm.ast
π¦ Outside of these packages, these changes also concern the following TokenManager
π¦ implementations, and their corresponding Parser if it exists (in the same package):- π
CppTokenManager
- π
JavaTokenManager
- π
Ecmascript5TokenManager
- π
JspTokenManager
- π
MatlabTokenManager
- π
ModelicaTokenManager
- π
ObjectiveCTokenManager
- π
PLSQLTokenManager
- π
PythonTokenManager
- π
VfTokenManager
- π
VmTokenManager
In the Java AST the following attributes are deprecated and will issue a warning when used in XPath rules:
- π
ASTAdditiveExpression#getImage
- usegetOperator()
instead - π
ASTVariableDeclaratorId#getImage
- usegetName()
instead - π
ASTVariableDeclaratorId#getVariableName
- usegetName()
instead
For removal
- π
Parser#getTokenManager
- π
TokenManager#setFileName
- π
AbstractTokenManager#setFileName
- π
AbstractTokenManager#getFileName
- π
AntlrToken#getType
- usegetKind()
instead. - π
ImmutableLanguage
- π€‘
MockRule
- π
Node#getFirstParentOfAnyType
- π
Node#getAsDocument
- π
AbstractNode#hasDescendantOfAnyType
- π
ASTRecordDeclaration#getComponentList
- π Multiple fields, constructors and methods in
XPathRule
. See javadoc for details.
External Contributions
- β‘οΈ #2312: [apex] Update ApexCRUDViolation Rule - Joshua S Arquilevich
- π #2314: [doc] maven integration - Add version to plugin - Pham Hai Trung
- #2353: [plsql] xmlforest with optional AS - Piotr Szymanski
- π #2383: [apex] Fix invalid apex in documentation - Gwilym Kuiper
- #2395: [apex] New Rule: Unused local variables - Gwilym Kuiper
- #2396: [apex] New rule: field declarations should be at start - Gwilym Kuiper
- π #2397: [apex] fixed WITH SECURITY_ENFORCED regex to recognise line break characters - Kieran Black
- π #2401: [doc] Update DoNotUseThreads rule documentation - Saikat Sengupta
- #2403: [java] #2402 fix false-positives on Primitive Streams - Bernd Farka
- π #2409: [java] ClassNamingConventions suggests to add Util for class containing only static constants, fixes #1164 - Binu R J
- #2411: [java] Fix UseAssertEqualsInsteadOfAssertTrue Example - Moritz Scheve
- π #2423: [core] Fix Checkstyle OperatorWrap in AbstractTokenizer - Harsh Kukreja
- π» #2432: [core] Close ZIP data sources even if a runtime exception or error is thrown - Gonzalo Exequiel Ibars Ingman
Stats
- 237 commits
- 64 closed tickets & PRs
- π Days since last release: 42
- apex-design
-
v6.22.0 Changes
March 12, 202012-March-2020 - 6.22.0
The PMD team is pleased to announce PMD 6.22.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
π Java 14 Support
π This release of PMD brings support for Java 14. PMD can parse Switch Expressions,
which have been promoted to be a standard language feature of Java.π PMD also parses Text Blocks as String literals, which is still a preview
language feature in Java 14.The new Pattern Matching for instanceof can be used as well as
Records.Note: The Text Blocks, Pattern Matching for instanceof and Records are all preview language features of OpenJDK 14
0οΈβ£ and are not enabled by default. In order to
analyze a project with PMD that uses these language features, you'll need to enable it via the environment
variablePMD_JAVA_OPTS
and select the new language version14-preview
:export PMD_JAVA_OPTS=--enable-preview ./run.sh pmd -language java -version 14-preview ...
π Note: Support for the extended break statement introduced in Java 12 as a preview language feature
π has been removed from PMD with this version. The version "12-preview" is no longer available.β‘οΈ Updated PMD Designer
π This PMD release ships a new version of the pmd-designer.
π For the changes, see PMD Designer Changelog.Apex Suppressions
β In addition to suppressing violation with the
@SuppressWarnings
annotation, Apex now also supports
π the suppressions with aNOPMD
comment. See Suppressing warnings.π Improved CPD support for C
The C# tokenizer is now based on an antlr grammar instead of a manual written tokenizer. This
π should give more accurate results and especially fixes the problems with the using statement syntax
π (see #2139).XPath Rules
π See the new documentation about Writing XPath Rules.
Note: As of PMD version 6.22.0, XPath versions 1.0 and the 1.0 compatibility mode are deprecated.
π XPath 2.0 is superior in many ways, for example for its support for type checking, sequence values,
or quantified expressions. For a detailed but approachable review of the features of XPath 2.0 and above,
π see the Saxon documentation.π New Rules
The Rule
CognitiveComplexity
(apex-design
) finds methods and classes
that are highly complex and therefore difficult to read and more costly to maintain. In contrast
to cyclomatic complexity, this rule uses "Cognitive Complexity", which is a measure of how
difficult it is for humans to read and understand a method.The Rule
TestMethodsMustBeInTestClasses
(apex-errorprone
) finds test methods
π that are not residing in a test class. The test methods should be moved to a proper test class.
π Support for tests inside functional classes was removed in Spring-13 (API Version 27.0), making classes
that violate this rule fail compile-time. This rule is however useful when dealing with legacy code.π Fixed Issues
- apex
- apex-design
- #2162: [apex] Cognitive Complexity rule
- apex-errorprone
- #639: [apex] Test methods should not be in classes other than test classes
- cs
- #2139: [cs] CPD doesn't understand alternate using statement syntax with C# 8.0
- doc
- #2274: [doc] Java API documentation for PMD
- java
- java-bestpractices
- #2277: [java] FP in UnusedImports for ambiguous static on-demand imports
- java-design
- #911: [java] UselessOverridingMethod false positive when elevating access modifier
- java-errorprone
- π java-performance
- #2275: [java] AppendCharacterWithChar flags literals in an expression
- plsql
- #2325: [plsql] NullPointerException while running parsing test for CREATE TRIGGER
- #2327: [plsql] Parsing of WHERE CURRENT OF
- #2328: [plsql] Support XMLROOT
- #2331: [plsql] Fix in Comment statement
- #2332: [plsql] Fixed Execute Immediate statement parsing
- #2340: [plsql] Fixed parsing / as divide or execute
API Changes
π 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.π
JavaLanguageParser
Implementations of
RuleViolationFactory
in each
language module, egJavaRuleViolationFactory
.
π See javadoc ofRuleViolationFactory
.Implementations of
RuleViolation
in each language module,
π egJavaRuleViolation
. See javadoc of
RuleViolation
.Constructors of
RuleSetFactory
, use factory methods fromRulesetsFactoryUtils
insteadAbstractApexNodeBase
, and the relatedvisit
π methods onApexParserVisitor
and its implementations.
π UseApexNode
instead, now considers comments too.For removal
- pmd-core
DFAGraphRule
and its implementationsDFAGraphMethod
- Many methods on the
Node
interface
π andAbstractNode
base class. See their javadoc for details. Node#isFindBoundary
is deprecated for XPath queries.- Many APIs of
net.sourceforge.pmd.lang.metrics
, though most of them were internal and
probably not used directly outside of PMD. UseMetricsUtil
as
a replacement for the language-specific faΓ§ades too. QualifiableNode
,QualifiedName
- pmd-java
AbstractJavaParser
AbstractJavaHandler
ASTAnyTypeDeclaration.TypeKind
ASTAnyTypeDeclaration#getKind
JavaQualifiedName
ASTCatchStatement#getBlock
ASTCompilationUnit#declarationsAreInDefaultPackage
JavaQualifiableNode
ASTAnyTypeDeclaration#getQualifiedName
ASTMethodOrConstructorDeclaration#getQualifiedName
ASTLambdaExpression#getQualifiedName
net.sourceforge.pmd.lang.java.qname
and its contentsMethodLikeNode
- Its methods will also be removed from its implementations,
ASTMethodOrConstructorDeclaration
,
ASTLambdaExpression
. ASTAnyTypeDeclaration#getImage
will be removed. Please usegetSimpleName()
instead. This affectsASTAnnotationTypeDeclaration#getImage
,
ASTClassOrInterfaceDeclaration#getImage
, and
ASTEnumDeclaration#getImage
.- Several methods of
ASTTryStatement
, replacements with other names
β have been added. This includes the XPath attribute@Finally
, replace it with a test forchild::FinallyStatement
. - Several methods named
getGuardExpressionNode
are replaced withgetCondition
. This affects the
following nodes: WhileStatement, DoStatement, ForStatement, IfStatement, AssertStatement, ConditionalExpression. ASTYieldStatement
will not implementTypeNode
β anymore come 7.0.0. Test the type of the expression nested within it.JavaMetrics
,JavaMetricsComputer
ASTArguments#getArgumentCount
.
π Usesize
instead.ASTFormalParameters#getParameterCount
.
π Usesize
instead.
- pmd-apex
In ASTs (JSP)
As part of the changes we'd like to do to AST classes for 7.0.0, we would like to
hide some methods and constructors that rule writers should not have access to.
The following usages are now deprecated in the JSP AST (with other languages to come):- π Manual instantiation of nodes. Constructors of node classes are deprecated and
π markedInternalApi
. Nodes should only be obtained from the parser,
which for rules, means that they never need to instantiate node themselves.
π¦ Those constructors will be made package private with 7.0.0. - Subclassing of abstract node classes, or usage of their type. The base classes are internal API
and will be hidden in version 7.0.0. You should not couple your code to them. - Setters found in any node class or interface. Rules should consider the AST immutable.
π¦ We will make those setters package private with 7.0.0. - π The class
JspParser
is deprecated and should not be used directly.
π UseLanguageVersionHandler#getParser
instead.
π¦ Please look at
net.sourceforge.pmd.lang.jsp.ast
to find out the full list of deprecations.In ASTs (Velocity)
As part of the changes we'd like to do to AST classes for 7.0.0, we would like to
hide some methods and constructors that rule writers should not have access to.
The following usages are now deprecated in the VM AST (with other languages to come):- π Manual instantiation of nodes. Constructors of node classes are deprecated and
π markedInternalApi
. Nodes should only be obtained from the parser,
which for rules, means that they never need to instantiate node themselves.
π¦ Those constructors will be made package private with 7.0.0. - Subclassing of abstract node classes, or usage of their type. The base classes are internal API
and will be hidden in version 7.0.0. You should not couple your code to them. - Setters found in any node class or interface. Rules should consider the AST immutable.
π¦ We will make those setters package private with 7.0.0. - π¦ The package
net.sourceforge.pmd.lang.vm.directive
as well as the classes
πDirectiveMapper
andLogUtil
are deprecated
π for removal. They were only used internally during parsing. - π The class
VmParser
is deprecated and should not be used directly.
π UseLanguageVersionHandler#getParser
instead.
π¦ Please look at
net.sourceforge.pmd.lang.vm.ast
to find out the full list of deprecations.PLSQL AST
π The production and node
ASTCursorBody
was unnecessary, not used and has been removed. Cursors have been already
π parsed asASTCursorSpecification
.External Contributions
- #2251: [java] FP for InvalidLogMessageFormat when using slf4j-Markers - Kris Scheibe
- π #2253: [modelica] Remove duplicated dependencies - Piotrek Ε»ygieΕo
- π #2256: [doc] Corrected XML attributes in release notes - Maikel Steneker
- #2276: [java] AppendCharacterWithCharRule ignore literals in expressions - Kris Scheibe
- #2278: [java] fix UnusedImports rule for ambiguous static on-demand imports - Kris Scheibe
- π #2279: [apex] Add support for suppressing violations using the // NOPMD comment - Gwilym Kuiper
- #2280: [cs] CPD: Replace C# tokenizer by an Antlr-based one - Maikel Steneker
- #2297: [apex] Cognitive complexity metrics - Gwilym Kuiper
- β #2317: [apex] New Rule - Test Methods Must Be In Test Classes - Brian NΓΈrremark
- π #2321: [apex] Support switch statements correctly in Cognitive Complexity - Gwilym Kuiper
- π #2326: [plsql] Added XML functions to parser: extract(xml), xml_root and fixed xml_forest - Piotr Szymanski
- π #2327: [plsql] Parsing of WHERE CURRENT OF added - Piotr Szymanski
- #2331: [plsql] Fix in Comment statement - Piotr Szymanski
- π #2332: [plsql] Fixed Execute Immediate statement parsing - Piotr Szymanski
- π #2338: [cs] CPD: fixes in filtering of using directives - Maikel Steneker
- π #2339: [cs] CPD: Fixed CPD --ignore-usings option - Maikel Steneker
- π #2340: [plsql] fix for parsing / as divide or execute - Piotr Szymanski
- β‘οΈ #2342: [xml] Update property used in example - Piotrek Ε»ygieΕo
- β‘οΈ #2344: [doc] Update ruleset examples for ant - Piotrek Ε»ygieΕo
- #2343: [ci] Disable checking for snapshots in jcenter - Piotrek Ε»ygieΕo
-
v6.21.0 Changes
January 24, 202024-January-2020 - 6.21.0
The PMD team is pleased to announce PMD 6.21.0.
π This is a minor release.
Table Of Contents
π New and noteworthy
π Modelica support
π Thanks to Anatoly Trosinenko PMD supports now a new language:
Modelica is a language to model complex physical systems.
π Both PMD and CPD are supported and there are already 3 rules available.
π The PMD Designer supports syntax highlighting for Modelica.π While the language implementation is quite complete, Modelica support is considered experimental
for now. This is to allow us to change the rule API (e.g. the AST classes) slightly and improve
the implementation based on your feedback.Simple XML dump of AST
We added a experimental feature to dump the AST of a source file into XML. The XML format
is of course PMD specific and language dependent. That XML file can be used to execute
(XPath) queries against without PMD. It can also be used as a textual visualization of the AST
if you don't want to use the Designer.π This feature is experimental and might change or even be removed in the future, if it is not
π useful. A short description how to use it is available under Creating XML dump of the AST.Any feedback about it, especially about your use cases, is highly appreciated.
β‘οΈ Updated Apex Support
- π The Apex language support has been bumped to version 48 (Spring '20). All new language features are now properly
π parsed and processed.
CPD XML format
The CPD XML output format has been enhanced to also report column information for found duplications
in addition to the line information. This allows to display the exact tokens, that are considered
duplicate.If a CPD language doesn't provide these exact information, then these additional attributes are omitted.
Each
<file>
element in the XML format now has 3 new attributes:- attribute
endline
- attribute
column
(if there is column information available) - attribute
endcolumn
(if there is column information available)
Modified Rules
The Java rule
AvoidLiteralsInIfCondition
(java-errorprone
) has a new property
0οΈβ£ignoreExpressions
. This property is set by default totrue
in order to maintain compatibility. If this
property is set to false, then literals in more complex expressions are considered as well.The Apex rule
ApexCSRF
(apex-errorprone
) has been moved from category
π "Security" to "Error Prone". The Apex runtime already prevents DML statements from being executed, but only
π at runtime. So, if you try to do this, you'll get an error at runtime, hence this is error prone. See also
the discussion on #2064.The Java rule
CommentRequired
(java-documentation
) has a new property
πclassCommentRequirement
. This replaces the now deprecated propertyheaderCommentRequirement
, since
the name was misleading. (File) header comments are not checked, but class comments are.π Fixed Issues
- apex
- #2208: [apex] ASTFormalComment should implement ApexNode<T>
- core
- #1984: [java] Cyclomatic complexity is misreported (lack of clearing metrics cache)
- #2006: [core] PMD should warn about multiple instances of the same rule in a ruleset
- #2161: [core] ResourceLoader is deprecated and marked as internal but is exposed
- #2170: [core] DocumentFile doesn't preserve newlines
- doc
- #2214: [doc] Link broken in pmd documentation for writing Xpath rules
- java
- #2212: [java] JavaRuleViolation reports wrong class name
- java-bestpractices
- #2149: [java] JUnitAssertionsShouldIncludeMessage - False positive with assertEquals and JUnit5
- π
java-codestyle
- #2167: [java] UnnecessaryLocalBeforeReturn false positive with variable captured by method reference
- π java-documentation
- #1683: [java] CommentRequired property names are inconsistent
- java-errorprone
- π java-performance
- #2141: [java] StringInstatiation: False negative with String-array access
- plsql
API Changes
π 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.π
JavaLanguageParser
Implementations of
RuleViolationFactory
in each
language module, egJavaRuleViolationFactory
.
π See javadoc ofRuleViolationFactory
.Implementations of
RuleViolation
in each language module,
π egJavaRuleViolation
. See javadoc of
RuleViolation
.Constructors of
RuleSetFactory
, use factory methods fromRulesetsFactoryUtils
insteadAbstractApexNodeBase
, and the relatedvisit
π methods onApexParserVisitor
and its implementations.
π UseApexNode
instead, now considers comments too.CharStream
,JavaCharStream
,
SimpleCharStream
: these are APIs used by our JavaCC
π¨ implementations and that will be moved/refactored for PMD 7.0.0. They should not
be used, extended or implemented directly.π All classes generated by JavaCC, eg
JJTJavaParserState
.
This includes token classes, which will be replaced with a single implementation, and
π subclasses ofParseException
, whose usages will be replaced
by just that superclass.For removal
- pmd-core
- Many methods on the
Node
interface
π andAbstractNode
base class. See their javadoc for details. Node#isFindBoundary
is deprecated for XPath queries.
- Many methods on the
- pmd-java
AbstractJavaParser
AbstractJavaHandler
ASTAnyTypeDeclaration.TypeKind
ASTAnyTypeDeclaration#getKind
JavaQualifiedName
ASTCatchStatement#getBlock
ASTCompilationUnit#declarationsAreInDefaultPackage
JavaQualifiableNode
ASTAnyTypeDeclaration#getQualifiedName
ASTMethodOrConstructorDeclaration#getQualifiedName
ASTLambdaExpression#getQualifiedName
net.sourceforge.pmd.lang.java.qname
and its contentsMethodLikeNode
- Its methods will also be removed from its implementations,
ASTMethodOrConstructorDeclaration
,
ASTLambdaExpression
. ASTAnyTypeDeclaration#getImage
will be removed. Please usegetSimpleName()
instead. This affectsASTAnnotationTypeDeclaration#getImage
,
ASTClassOrInterfaceDeclaration#getImage
, and
ASTEnumDeclaration#getImage
.- Several methods of
ASTTryStatement
, replacements with other names
β have been added. This includes the XPath attribute@Finally
, replace it with a test forchild::FinallyStatement
. - Several methods named
getGuardExpressionNode
are replaced withgetCondition
. This affects the
following nodes: WhileStatement, DoStatement, ForStatement, IfStatement, AssertStatement, ConditionalExpression. ASTYieldStatement
will not implementTypeNode
β anymore come 7.0.0. Test the type of the expression nested within it.
External Contributions
- #2041: [modelica] Initial implementation for PMD - Anatoly Trosinenko
- β‘οΈ #2051: [doc] Update the docs on adding a new language - Anatoly Trosinenko
- #2069: [java] CommentRequired: make property names consistent - snuyanzin
- π #2169: [modelica] Follow-up fixes for Modelica language module - Anatoly Trosinenko
- β #2193: [core] Fix odd logic in test runner - Egor Bredikhin
- #2194: [java] Fix odd logic in AvoidUsingHardCodedIPRule - Egor Bredikhin
- #2195: [modelica] Normalize invalid node ranges - Anatoly Trosinenko
- #2199: [modelica] Fix Javadoc tags - Anatoly Trosinenko
- #2225: [core] CPD: report endLine / column informations for found duplications - Maikel Steneker
- π The Apex language support has been bumped to version 48 (Spring '20). All new language features are now properly
-
v6.21.0-with Changes
January 24, 2020π This release is identical to the 6.21.0 release, but it includes the newest version of the rule designer. Technically it's a prerelease of 6.22.0 (you'll find that the jar versions reflect this).
π PMD release notes
π Please refer to the 6.21.0 PMD release
π Designer release notes
π Please refer to the 6.21.0 designer release