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 missing hashCode() and/or equals() methods on types that implement Comparable. 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 the Set interface. While the Set interface relies on equals() to determine object equality, sorted sets like TreeSet use compareTo() instead. The same issue can arise when such objects are used as keys in sorted maps.
    This rule is very similar to OverrideBothEqualsAndHashcode which has always been skipping Comparable 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 rule UnnecessaryLocalBeforeReturn 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

🐛 Fixed Issues

  • apex-codestyle
    • #5650: [apex] New Rule: AnnotationsNamingConventions
  • core
    • #4721: chore: [core] Enable XML rule MissingEncoding in dogfood ruleset
  • java
    • #5874: [java] Update java regression tests with Java 25 language features
    • #5960: [java] Avoid/reduce duplicate error messages for some rules
  • java-bestpractices
    • #2186: [java] New rule: Reliance on default charset
    • #4500: [java] AvoidReassigningLoopVariables - false negatives within for-loops and skip allowed
    • #5198: [java] CheckResultSet false-positive with local variable checked in a while loop
  • java-codestyle
    • #972: [java] Improve naming conventions rules
    • #5770: [java] New Rule: VariableCanBeInlined: Local variables should not be declared and then immediately returned or thrown
    • #5948: [java] UnnecessaryBoxing false positive when calling List.remove(int)
  • java-design
    • #4911: [java] AvoidRethrowingException should allow rethrowing exception subclasses
    • #5023: [java] UseUtilityClass implementation hardcodes a message instead of using the one defined in the XML
  • 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

✨ 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)

📦 Dependency updates

📈 Stats