Table of Contents
12-September-2025 - 7.17.0-SNAPSHOT
The PMD team is pleased to announce PMD 7.17.0-SNAPSHOT.
This is a minor release.
🚀 New and noteworthy
✨ New Rules
- The new apex rule
AnnotationsNamingConventions
enforces that annotations are used consistently in PascalCase.
The rule is referenced in the quickstart.xml ruleset for Apex. - The new java rule
TypeParameterNamingConventions
replaces the now deprecated rule GenericsNaming. The new rule is configurable and checks for naming conventions of type parameters in generic types and methods. It can be configured via a regular expression.
By default, this rule uses the standard Java naming convention (single uppercase letter).
The rule is referenced in the quickstart.xml ruleset for Java. - The new java rule
OverrideBothEqualsAndHashCodeOnComparable
finds missinghashCode()
and/orequals()
methods on types that implementComparable
. This is important if instances of these classes are used in collections. Failing to do so can lead to unexpected behavior in sets which then do not conform to theSet
interface. While theSet
interface relies onequals()
to determine object equality, sorted sets likeTreeSet
usecompareTo()
instead. The same issue can arise when such objects are used as keys in sorted maps.
This rule is very similar toOverrideBothEqualsAndHashcode
which has always been skippingComparable
and only reports if one of the two methods is missing. The new rule will also report, if both methods (hashCode and equals) are missing.
The rule is referenced in the quickstart.xml ruleset for Java. - The new java rule
UselessPureMethodCall
finds method calls of pure methods whose result is not used. Ignoring the result of such method calls is likely as mistake as pure methods are side effect free.
The rule is referenced in the quickstart.xml ruleset for Java. - The new java rule
RelianceOnDefaultCharset
finds method calls that depend on the JVM’s default charset. Using these method without specifying the charset explicitly can lead to unexpected behavior on different platforms. - Thew new java rule
VariableCanBeInlined
finds local variables that are immediately returned or thrown. This rule replaces the old ruleUnnecessaryLocalBeforeReturn
which only considered return statements. The new rule also finds unnecessary local variables before throw statements.
The rule is referenced in the quickstart.xml ruleset for Java.
Deprecated Rules
- The java rule
GenericsNaming
has been deprecated for removal in favor of the new ruleTypeParameterNamingConventions
. - The java rule
AvoidLosingExceptionInformation
has been deprecated for removal in favor of the new ruleUselessPureMethodCall
. - The java rule
UselessOperationOnImmutable
has been deprecated for removal in favor of the new ruleUselessPureMethodCall
. - The java rule
UnnecessaryLocalBeforeReturn
has been deprecated for removal in favor of the new ruleVariableCanBeInlined
.
🐛 Fixed Issues
- apex-codestyle
- #5650: [apex] New Rule: AnnotationsNamingConventions
- core
- #4721: chore: [core] Enable XML rule MissingEncoding in dogfood ruleset
- java
- java-bestpractices
- java-codestyle
- java-design
- java-errorprone
- #3401: [java] Improve AvoidUsingOctalValues documentation
- #3434: [java] False negatives in AssignmentInOperand Rule
- #5837: [java] New Rule OverrideBothEqualsAndHashCodeOnComparable
- #5881: [java] AvoidLosingExceptionInformation does not trigger when inside if-else
- #5915: [java] AssignmentInOperand not raised when inside do-while loop
- #5974: [java] CloseResourceRule: NullPointerException while analyzing
🚨 API Changes
Deprecations
- test
- The method
AbstractRuleSetFactoryTest#hasCorrectEncoding
will be removed. PMD has the ruleMissingEncoding
for XML files that should be used instead.
- The method
✨ Merged pull requests
- #5822: Fix #5650: [apex] New Rule: AnnotationsNamingConventions - Mitch Spano (@mitchspano)
- #5847: Fix #5770: [java] New Rule: VariableCanBeInlined - Vincent Potucek (@Pankraz76)
- #5856: Fix #5837: [java] New Rule OverrideBothEqualsAndHashCodeOnComparable - Vincent Potucek (@Pankraz76)
- #5907: [java] New rule: UselessPureMethodCall - Zbynek Konecny (@zbynek)
- #5922: Fix #972: [java] Add a new rule TypeParameterNamingConventions - UncleOwen (@UncleOwen)
- #5924: Fix #5915: [java] Fix AssignmentInOperandRule to also work an do-while loops and switch statements - UncleOwen (@UncleOwen)
- #5930: Fix #4500: [java] Fix AvoidReassigningLoopVariablesRule to allow only simple assignments in the forReassign=skip case - UncleOwen (@UncleOwen)
- #5931: Fix #5023: [java] Fix UseUtilityClassRule to use the message provided in design.xml - UncleOwen (@UncleOwen)
- #5932: [ci] Reuse GitHub Pre-Releases - Andreas Dangel (@adangel)
- #5934: Fix #2186: [java] New Rule: RelianceOnDefaultCharset - UncleOwen (@UncleOwen)
- #5938: [doc] Update suppression docs to reflect PMD 7 changes - Zbynek Konecny (@zbynek)
- #5939: Fix #5198: [java] CheckResultSet FP when local variable is checked - Lukas Gräf (@lukasgraef)
- #5954: Fix #4721: [core] Enable XML rule MissingEncoding in dogfood ruleset - Andreas Dangel (@adangel)
- #5955: chore: Fix LiteralsFirstInComparison violations in test code - Andreas Dangel (@adangel)
- #5957: Fix #3401: [java] Improve message/description/examples for AvoidUsingOctalValues - UncleOwen (@UncleOwen)
- #5959: Fix #5960: [java] AddEmptyString: Improve report location - Zbynek Konecny (@zbynek)
- #5961: Fix #5960: [java] Add details to the error message for some rules - Zbynek Konecny (@zbynek)
- #5965: Fix #5881: AvoidLosingException - Consider nested method calls - Andreas Dangel (@adangel)
- #5967: [doc][java] ReplaceJavaUtilDate - improve doc to mention java.sql.Date - Andreas Dangel (@adangel)
- #5970: chore: CI improvements - Andreas Dangel (@adangel)
- #5971: Fix #5948: [java] UnnecessaryBoxingRule: Check if unboxing is required for overload resolution - UncleOwen (@UncleOwen)
- #5972: Fix #3434: [java] False negatives in AssignmentInOperand rule - UncleOwen (@UncleOwen)
- #5979: Fix #5974: [java] NPE in CloseResourceRule - Lukas Gräf (@lukasgraef)
- #5980: chore: Fix typos - Zbynek Konecny (@zbynek)
- #5981: Fix #4911: [java] AvoidRethrowingException consider supertypes in following catches - UncleOwen (@UncleOwen)
- #5989: [java] Improve performance of RelianceOnDefaultCharset - UncleOwen (@UncleOwen)