|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: PMD 7.5.0 released |
| 4 | +--- |
| 5 | + |
| 6 | +## 30-August-2024 - 7.5.0 |
| 7 | + |
| 8 | +The PMD team is pleased to announce PMD 7.5.0. |
| 9 | + |
| 10 | +This is a minor release. |
| 11 | + |
| 12 | +### Table Of Contents |
| 13 | + |
| 14 | +* [🚀 New: Java 23 Support](#new-java-23-support) |
| 15 | +* [🌟 New Rules](#new-rules) |
| 16 | +* [🐛 Fixed Issues](#fixed-issues) |
| 17 | +* [🚨 API Changes](#api-changes) |
| 18 | + * [Deprecations](#deprecations) |
| 19 | + * [Experimental](#experimental) |
| 20 | +* [✨ External Contributions](#external-contributions) |
| 21 | +* [📦 Dependency updates](#dependency-updates) |
| 22 | +* [📈 Stats](#stats) |
| 23 | + |
| 24 | +### 🚀 New: Java 23 Support |
| 25 | +This release of PMD brings support for Java 23. There are no new standard language features, |
| 26 | +but a couple of preview language features: |
| 27 | + |
| 28 | +* [JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview)](https://openjdk.org/jeps/455) |
| 29 | +* [JEP 476: Module Import Declarations (Preview)](https://openjdk.org/jeps/476) |
| 30 | +* [JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview)](https://openjdk.org/jeps/477) |
| 31 | +* [JEP 482: Flexible Constructor Bodies (Second Preview)](https://openjdk.org/jeps/482) |
| 32 | + |
| 33 | +Note that String Templates (introduced as preview in Java 21 and 22) are not supported anymore in Java 23, |
| 34 | +see [JDK-8329949](https://bugs.openjdk.org/browse/JDK-8329949) for details. |
| 35 | + |
| 36 | +In order to analyze a project with PMD that uses these preview language features, |
| 37 | +you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language |
| 38 | +version `23-preview`: |
| 39 | + |
| 40 | + export PMD_JAVA_OPTS=--enable-preview |
| 41 | + pmd check --use-version java-23-preview ... |
| 42 | + |
| 43 | +Note: Support for Java 21 preview language features have been removed. The version "21-preview" |
| 44 | +are no longer available. |
| 45 | + |
| 46 | +### 🌟 New Rules |
| 47 | +* The new Java rule [`AvoidSynchronizedStatement`](https://docs.pmd-code.org/pmd-doc-7.5.0/pmd_rules_java_multithreading.html#avoidsynchronizedstatement) finds synchronization blocks that |
| 48 | + could cause performance issues with virtual threads due to pinning. |
| 49 | +* The new JavaScript rule [`AvoidConsoleStatements`](https://docs.pmd-code.org/pmd-doc-7.5.0/pmd_rules_ecmascript_performance.html#avoidconsolestatements) finds any function calls |
| 50 | + on the Console API (e.g. `console.log`). Using these in production code might negatively impact performance. |
| 51 | + |
| 52 | +### 🐛 Fixed Issues |
| 53 | +* apex-performance |
| 54 | + * [#5139](https://github.com/pmd/pmd/issues/5139): \[apex] OperationWithHighCostInLoop: false negative for triggers |
| 55 | +* java |
| 56 | + * [#5062](https://github.com/pmd/pmd/issues/5062): \[java] Support Java 23 |
| 57 | + * [#5167](https://github.com/pmd/pmd/issues/5167): \[java] java.lang.IllegalArgumentException: \<?\> cannot be a wildcard bound |
| 58 | +* java-bestpractices |
| 59 | + * [#3602](https://github.com/pmd/pmd/issues/3602): \[java] GuardLogStatement: False positive when compile-time constant is created from external constants |
| 60 | + * [#4731](https://github.com/pmd/pmd/issues/4731): \[java] GuardLogStatement: Documentation is unclear why getters are flagged |
| 61 | + * [#5145](https://github.com/pmd/pmd/issues/5145): \[java] UnusedPrivateMethod: False positive with method calls inside lambda |
| 62 | + * [#5151](https://github.com/pmd/pmd/issues/5151): \[java] GuardLogStatement: Should not need to guard parameterized log messages where the replacement arg is a constant from another class |
| 63 | + * [#5152](https://github.com/pmd/pmd/issues/5152): \[java] GuardLogStatement: Should not need to guard parameterized log messages where the replacement arg is "this" |
| 64 | + * [#5153](https://github.com/pmd/pmd/issues/5153): \[java] GuardLogStatement: Should not need to guard parameterized log messages where the replacement arg is an array element |
| 65 | +* java-design |
| 66 | + * [#5048](https://github.com/pmd/pmd/issues/5084): \[java] CognitiveComplexity: Exception when using Map.of() |
| 67 | + * [#5162](https://github.com/pmd/pmd/issues/5162): \[java] SingularField: False-positive when preceded by synchronized block |
| 68 | +* java-multithreading |
| 69 | + * [#5175](https://github.com/pmd/pmd/issues/5175): \[java] Update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock, new rule AvoidSynchronizedStatement |
| 70 | +* javascript-performance |
| 71 | + * [#5105](https://github.com/pmd/pmd/issues/5105): \[javascript] Prohibit any console methods |
| 72 | +* plsql |
| 73 | + * [#5125](https://github.com/pmd/pmd/pull/5125): \[plsql] Improve merge statement (order of merge insert/update flexible, allow prefixes in column names) |
| 74 | +* plsql-bestpractices |
| 75 | + * [#5132](https://github.com/pmd/pmd/issues/5132): \[plsql] TomKytesDespair: XPathException for more complex exception handler |
| 76 | + |
| 77 | +### 🚨 API Changes |
| 78 | +#### Deprecations |
| 79 | +* pmd-jsp |
| 80 | + * <a href="https://docs.pmd-code.org/apidocs/pmd-jsp/7.5.0/net/sourceforge/pmd/lang/jsp/ast/JspParserImpl.html#"><code>JspParserImpl</code></a> is deprecated now. It should have been package-private |
| 81 | + because this is an implementation class that should not be used directly. |
| 82 | +* pmd-plsql |
| 83 | + * <a href="https://docs.pmd-code.org/apidocs/pmd-plsql/7.5.0/net/sourceforge/pmd/lang/plsql/ast/PLSQLParserImpl.html#MergeUpdateClausePrefix()"><code>MergeUpdateClausePrefix</code></a> is deprecated. This production is |
| 84 | + not used anymore and will be removed. Note: The whole parser implementation class has been deprecated since 7.3.0, |
| 85 | + as it is supposed to be internalized. |
| 86 | +* pmd-velocity |
| 87 | + * <a href="https://docs.pmd-code.org/apidocs/pmd-velocity/7.5.0/net/sourceforge/pmd/lang/velocity/ast/VtlParserImpl.html#"><code>VtlParserImpl</code></a> is deprecated now. It should have been package-private |
| 88 | + because this is an implementation class that should not be used directly. |
| 89 | +* pmd-visualforce |
| 90 | + * <a href="https://docs.pmd-code.org/apidocs/pmd-visualforce/7.5.0/net/sourceforge/pmd/lang/visualforce/ast/VfParserImpl.html#"><code>VfParserImpl</code></a> is deprecated now. It should have been package-private |
| 91 | + because this is an implementation class that should not be used directly. |
| 92 | + |
| 93 | +#### Experimental |
| 94 | +* pmd-java |
| 95 | + * Renamed `isUnnamedClass()` to <a href="https://docs.pmd-code.org/apidocs/pmd-java/7.5.0/net/sourceforge/pmd/lang/java/ast/ASTCompilationUnit.html#isSimpleCompilationUnit()"><code>ASTCompilationUnit#isSimpleCompilationUnit</code></a> |
| 96 | + * <a href="https://docs.pmd-code.org/apidocs/pmd-java/7.5.0/net/sourceforge/pmd/lang/java/ast/ASTImplicitClassDeclaration.html#"><code>ASTImplicitClassDeclaration</code></a> |
| 97 | + * <a href="https://docs.pmd-code.org/apidocs/pmd-java/7.5.0/net/sourceforge/pmd/lang/java/ast/ASTImportDeclaration.html#isModuleImport()"><code>ASTImportDeclaration#isModuleImport</code></a> |
| 98 | + * <a href="https://docs.pmd-code.org/apidocs/pmd-java/7.5.0/net/sourceforge/pmd/lang/java/ast/JavaVisitorBase.html#visit(net.sourceforge.pmd.lang.java.ast.ASTImplicitClassDeclaration,P)"><code>JavaVisitorBase#visit(ASTImplicitClassDeclaration, P)</code></a> |
| 99 | + |
| 100 | +### ✨ External Contributions |
| 101 | +* [#5125](https://github.com/pmd/pmd/pull/5125): \[plsql] Improve merge statement (order of merge insert/update flexible, allow prefixes in column names) - [Arjen Duursma](https://github.com/duursma) (@duursma) |
| 102 | +* [#5175](https://github.com/pmd/pmd/pull/5175): \[java] Update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock, new rule AvoidSynchronizedStatement - [Chas Honton](https://github.com/chonton) (@chonton) |
| 103 | + |
| 104 | +### 📦 Dependency updates |
| 105 | +* [#5100](https://github.com/pmd/pmd/issues/5100): Enable Dependabot |
| 106 | +* [#5141](https://github.com/pmd/pmd/issues/5141): Bump org.apache.maven.plugins:maven-checkstyle-plugin from 3.3.1 to 3.4.0 |
| 107 | +* [#5142](https://github.com/pmd/pmd/issues/5142): Bump org.apache.maven.plugins:maven-compiler-plugin from 3.12.1 to 3.13.0 |
| 108 | +* [#5144](https://github.com/pmd/pmd/issues/5144): Bump org.codehaus.mojo:versions-maven-plugin from 2.16.2 to 2.17.1 |
| 109 | +* [#5148](https://github.com/pmd/pmd/issues/5148): Bump org.apache.commons:commons-text from 1.11.0 to 1.12.0 |
| 110 | +* [#5149](https://github.com/pmd/pmd/issues/5149): Bump org.apache.maven.plugins:maven-site-plugin from 4.0.0-M13 to 4.0.0-M16 |
| 111 | +* [#5160](https://github.com/pmd/pmd/issues/5160): Bump org.pcollections:pcollections from 3.2.0 to 4.0.2 |
| 112 | +* [#5161](https://github.com/pmd/pmd/issues/5161): Bump danger from 9.4.3 to 9.5.0 in the all-gems group across 1 directory |
| 113 | +* [#5164](https://github.com/pmd/pmd/issues/5164): Bump org.apache.maven.plugins:maven-dependency-plugin from 3.6.1 to 3.7.1 |
| 114 | +* [#5165](https://github.com/pmd/pmd/issues/5165): Bump the all-gems group across 1 directory with 2 updates |
| 115 | +* [#5171](https://github.com/pmd/pmd/issues/5171): Bump net.bytebuddy:byte-buddy-agent from 1.14.12 to 1.14.19 |
| 116 | +* [#5180](https://github.com/pmd/pmd/issues/5180): Bump net.sf.saxon:Saxon-HE from 12.4 to 12.5 |
| 117 | + |
| 118 | +### 📈 Stats |
| 119 | +* 87 commits |
| 120 | +* 25 closed tickets & PRs |
| 121 | +* Days since last release: 35 |
0 commit comments