Table of Contents
27-November-2026 - 7.30.0-SNAPSHOT
The PMD team is pleased to announce PMD 7.30.0-SNAPSHOT.
This is a minor release.
🚀️ New and noteworthy
🌟️ New and Changed Rules
New Rules
- The new Java rule
ControlFlowInTestreports control flow in test methods that can obscure which assertions are executed. It checks conditionals, switch statements and expressions, explicit throw statements, try statements with catch clauses, and plain try-finally statements. Loops are allowed by default and can be reported by settingallowLoopstofalse.
Changed Rules
- The Apex rule
ApexUnitTestShouldNotUseSeeAllDataTruehas a new propertyreportConnectApi. It defaults totrue. Set it tofalse, and the rule does not reportseeAllData=trueon a test class or test method that calls aConnectApimethod, since mostConnectApimethods requireseeAllData=truein tests. A call to asetTest...method does not stop the rule from reporting, because it only registers test data. Nor does a call to the regular method whose test data asetTest...call in the same test registers (see #7236).
Deprecated Rules
- The Java rule
AddEmptyStringis deprecated without replacement and will be removed with PMD 8.0.0. Its performance claim is not valid on modern JDKs: constant string concatenations are evaluated at compile time, and replacing concatenation withtoString()orString.valueOf()does not generally improve performance. The rule is excluded when referencing the whole Performance category, but explicit rule references continue to work during the deprecation period.
🐛️ Fixed Issues
- apex
- apex-bestpractices
- apex-design
- #4863: [apex] CyclomaticComplexity: False negative with switch statements
- apex-errorprone
- #5906: [apex] MethodWithSameNameAsEnclosingClass: Violation range should only cover the method name
- core
- #5760: [core] SarifRenderer does not respect relativizeRoots
- java
- #7144: [java] Lambda block body that cannot complete normally is not treated as value-compatible
- #7240: [java] “Not a Java binary name” when importing a class with non-ASCII (e.g. Japanese) letters in its name; the whole file is skipped
- #7313: [java] Casts to boolean and boolean equality are not folded as constant expressions
- java-bestpractices
- #5016: [java] UnusedAssignment: False positive boolean flag for execution and reset in finally
- #7070: [java] CheckResultSet: False negative caused by unrelated if/while
- #7116: [java] New rule: ControlFlowInTest
- #7216: [java] GuardLogStatement: False positive on SLF4J parameterised calls whose arguments are wrapped with logstash value(…)
- java-codestyle
- java-design
- #5798: [java] NPathComplexity: Short-circuit operators outside of conditions counted as branches
- #7277: [java] AvoidRethrowingException: False negative if rethrow is wrapped in a block, ExceptionAsFlowControl false positive instead
- #7279: [java] InternalApiUsage: False positive when static field is used in constructor
- java-errorprone
- java-multithreading
- #2786: [java] False positive for UseConcurrentHashMap on ConcurrentSkipListMap
- java-performance
- jsp
- #5092: [jsp] Parse error when
<!DOCTYPE>or<?xml?>follows other content
- #5092: [jsp] Parse error when
- kotlin
- misc
- #6655: Deprecate ANTLR generated lexer implementation classes
🚨️ API Changes and Deprecations
- apex
- DML statement nodes now expose
@AccessMode. The attribute is always present. Its value isIMPLICIT,USER_MODE, orSYSTEM_MODE.//DmlInsertStatement[@AccessMode='IMPLICIT']and//DmlInsertStatement[@AccessMode='SYSTEM_MODE']select those statements.
- DML statement nodes now expose
Experimental API
- kotlin
KtVariableDeclarationAttributesnow implementsHasTypeName, soVariableDeclarationnodes have a@TypeNameattribute. This covers property and for-loop variables, lambda parameters, and each component of a destructuring declaration (val (a, b) = ...,for ((a, b) in ...),{ (a, b) -> ... }). The XPath functionspmd-kotlin:typeIs,pmd-kotlin:typeIsExactlyandpmd-kotlin:isNullablesupportVariableDeclarationnodes as well.- A destructuring
PropertyDeclaration(e.g.val (a, b) = Pair(1, "x")) no longer has a@TypeName. Before, it wrongly got the type of the first component. To find destructured variables by type, query the component nodes instead://VariableDeclaration[pmd-kotlin:typeIs('kotlin.Int')].
Deprecations
- apex
AbstractDmlStatement#getRunAsModehas been deprecated. UsegetAccessModeinstead.
- coco
CocoLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- css
CssLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- csharp
CSharpLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- dart
DartLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- gherkin
GherkinLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- go
GolangLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- javascript
TypeScriptLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- julia
JuliaLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- kotlin
KotlinBaseListenerhas been deprecated. The class is an implementation detail and should have never been part of the public API.KotlinLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.KotlinListenerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- lua
LuaLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- rust
RustLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- swift
SwiftBaseListenerhas been deprecated. The class is an implementation detail and should have never been part of the public API.SwiftLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.SwiftListenerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- tsql
TSqlLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- xml
XMLLexerhas been deprecated. The class is an implementation detail and should have never been part of the public API.
- The generated
KotlinParserandSwiftParserclasses and their nested AST node classes are intentionally not deprecated yet. These classes still contain the public AST node types, which have no replacement API yet. They will be deprecated once we have decided how to handle the inner classes.
Other API changes
- xml
- The new class
XmlRootNodeis the root node of the XML AST. It replaces the classXmlParserImpl.RootXmlNode, which was in an internal package.XmlNode#getRootnow returnsXmlRootNode. XmlParseris now public and has moved from packagenet.sourceforge.pmd.lang.xmlintonet.sourceforge.pmd.lang.xml.ast, like the parsers of other languages.- The internal package
net.sourceforge.pmd.lang.xml.ast.internalhas been removed. Its classes are now package-private innet.sourceforge.pmd.lang.xml.ast.
- The new class