title: PMD Release Notes
permalink: pmd_release_notes.html
keywords: changelog, release notes
{% if is_release_notes_processor %}
{% comment %}
This allows to use links e.g. Basic CLI usage that work both
in the release notes on GitHub (as an absolute url) and on the rendered documentation page (as a relative url).
{% endcomment %}
{% capture baseurl %}https://docs.pmd-code.org/pmd-doc-{{ site.pmd.version }}/{% endcapture %}
{% else %}
{% assign baseurl = "" %}
{% endif %}
{{ site.pmd.date | date: "%d-%B-%Y" }} - {{ site.pmd.version }}
The PMD team is pleased to announce PMD {{ site.pmd.version }}.
This is a {{ site.pmd.release_type }} release.
{% tocmaker is_release_notes_processor %}
🚀 New and noteworthy
✨ New Rules
- The new apex rule {% rule apex/codestyle/AnnotationsNamingConventions %} enforces that annotations
are used consistently in PascalCase.
The rule is referenced in the quickstart.xml ruleset for Apex.
- The new java rule {% rule java/codestyle/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 {% rule java/errorprone/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 {% rule java/errorprone/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 {% rule java/errorprone/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 {% rule java/bestpractices/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 {% rule java/codestyle/VariableCanBeInlined %} finds local variables that are
immediately returned or thrown. This rule replaces the old rule {% rule java/codestyle/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
- The java rule {% rule java/codestyle/GenericsNaming %} has been deprecated for removal in favor
of the new rule {% rule java/codestyle/TypeParameterNamingConventions %}.
- The java rule {% rule java/errorprone/AvoidLosingExceptionInformation %} has been deprecated for removal
in favor of the new rule {% rule java/errorprone/UselessPureMethodCall %}.
- The java rule {% rule java/errorprone/UselessOperationOnImmutable %} has been deprecated for removal
in favor of the new rule {% rule java/errorprone/UselessPureMethodCall %}.
- The java rule {% rule java/codestyle/UnnecessaryLocalBeforeReturn %} has been deprecated for removal
in favor of the new rule {% rule java/codestyle/VariableCanBeInlined %}.
🐛 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
- test
- The method {%jdoc !!test::test.lang.rule.AbstractRuleSetFactoryTest#hasCorrectEncoding(java.lang.String) %} will be removed.
PMD has the rule {% rule xml/bestpractices/MissingEncoding %} for XML files that should be used instead.
✨ Merged pull requests
📦 Dependency updates
📈 Stats
{% endtocmaker %}