From 99948c8fb69edb229849ffd325db29f31ab4a461 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 10 Aug 2023 14:43:45 +0200 Subject: [PATCH] [doc] Update release notes (JDK 21 Support) --- docs/pages/release_notes.md | 73 ++++++++++++++++++++++++++++++++ docs/pages/release_notes_pmd7.md | 23 ++++++++++ 2 files changed, 96 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 9532f360fb..47c63ab72f 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -39,6 +39,31 @@ for all.

This section lists the most important changes from the last release candidate. The remaining section describes the complete release notes for 7.0.0. +#### New and noteworthy + +##### Java 21 Support + +This release of PMD brings support for Java 21. There are the following new standard language features, +that are supported now: + +* [JEP 440: Record Patterns](https://openjdk.org/jeps/440) +* [JEP 441: Pattern Matching for switch](https://openjdk.org/jeps/441) + +PMD also supports the following preview language features: + +* [JEP 430: String Templates (Preview)](https://openjdk.org/jeps/430) +* [JEP 443: Unnamed Patterns and Variables (Preview)](https://openjdk.org/jeps/443) +* [JEP 445: Unnamed Classes and Instance Main Methods (Preview)](https://openjdk.org/jeps/445) + +In order to analyze a project with PMD that uses these language features, +you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language +version `21-preview`: + + export PMD_JAVA_OPTS=--enable-preview + pmd check --use-version java-21-preview ... + +Note: Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available. + #### Fixed issues * miscellaneous @@ -49,11 +74,35 @@ The remaining section describes the complete release notes for 7.0.0. * [#4596](https://github.com/pmd/pmd/issues/4596): \[apex] ExcessivePublicCount ignores properties * java * [#4401](https://github.com/pmd/pmd/issues/4401): \[java] PMD 7 fails to build under Java 19 + * [#4583](https://github.com/pmd/pmd/issues/4583): \[java] Support JDK 21 (LTS) * java-bestpractices * [#4634](https://github.com/pmd/pmd/issues/4634): \[java] JUnit4TestShouldUseTestAnnotation false positive with TestNG #### API Changes +##### Java + +* Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available. + +##### Deprecated API + +* The method {%jdoc !!java::lang.java.ast.ASTPattern#getParenthesisDepth() %} has been deprecated and will be removed. + It was introduced for supporting parenthesized patterns, but that was removed with Java 21. It is only used when + parsing code as java-19-preview. + +##### Experimental APIs + +* To support the Java preview language features "String Templates" and "Unnamed Patterns and Variables", the following + AST nodes have been introduced as experimental: + * {% jdoc java::lang.java.ast.ASTTemplateExpression %} + * {% jdoc java::lang.java.ast.ASTTemplate %} + * {% jdoc java::lang.java.ast.ASTTemplateFragment %} + * {% jdoc java::lang.java.ast.ASTUnnamedPattern %} +* The AST nodes for supporting "Record Patterns" and "Pattern Matching for switch" are not experimental anymore: + * {% jdoc java::lang.jast.ast.ASTRecordPattern %} + * {% jdoc java::lang.jast.ast.ASTPatternList %} (Note: it was renamed from `ASTComponentPatternList`) + * {% jdoc java::lang.jast.ast. %} (Note: it was renamed from `ASTSwitchGuard`) + #### External Contributions * [#4528](https://github.com/pmd/pmd/pull/4528): \[apex] Update to apexlink - [Kevin Jones](https://github.com/nawforce) (@nawforce) * [#4637](https://github.com/pmd/pmd/pull/4637): \[java] fix #4634 - JUnit4TestShouldUseTestAnnotation false positive with TestNG - [Krystian Dabrowski](https://github.com/krdabrowski) (@krdabrowski) @@ -161,6 +210,29 @@ module `pmd-coco`. Contributors: [Wener](https://github.com/wener-tiobe) (@wener-tiobe) +#### New: Java 21 Support + +This release of PMD brings support for Java 21. There are the following new standard language features, +that are supported now: + +* [JEP 440: Record Patterns](https://openjdk.org/jeps/440) +* [JEP 441: Pattern Matching for switch](https://openjdk.org/jeps/441) + +PMD also supports the following preview language features: + +* [JEP 430: String Templates (Preview)](https://openjdk.org/jeps/430) +* [JEP 443: Unnamed Patterns and Variables (Preview)](https://openjdk.org/jeps/443) +* [JEP 445: Unnamed Classes and Instance Main Methods (Preview)](https://openjdk.org/jeps/445) + +In order to analyze a project with PMD that uses these language features, +you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language +version `21-preview`: + + export PMD_JAVA_OPTS=--enable-preview + pmd check --use-version java-21-preview ... + +Note: Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available. + #### Changed: JavaScript support * latest version supports ES6 and also some new constructs (see [Rhino](https://github.com/mozilla/rhino)]) @@ -439,6 +511,7 @@ Language specific fixes: * [#4383](https://github.com/pmd/pmd/issues/4383): \[java] IllegalStateException: Object is not an array type! * [#4401](https://github.com/pmd/pmd/issues/4401): \[java] PMD 7 fails to build under Java 19 * [#4405](https://github.com/pmd/pmd/issues/4405): \[java] Processing error with ArrayIndexOutOfBoundsException + * [#4583](https://github.com/pmd/pmd/issues/4583): \[java] Support JDK 21 (LTS) * java-bestpractices * [#342](https://github.com/pmd/pmd/issues/342): \[java] AccessorMethodGeneration: Name clash with another public field not properly handled * [#755](https://github.com/pmd/pmd/issues/755): \[java] AccessorClassGeneration false positive for private constructors diff --git a/docs/pages/release_notes_pmd7.md b/docs/pages/release_notes_pmd7.md index 39b7e54efc..d20ff50bc1 100644 --- a/docs/pages/release_notes_pmd7.md +++ b/docs/pages/release_notes_pmd7.md @@ -517,6 +517,29 @@ module `pmd-coco`. Contributors: [Wener](https://github.com/wener-tiobe) (@wener-tiobe) +### New: Java 21 Support + +This release of PMD brings support for Java 21. There are the following new standard language features, +that are supported now: + +* [JEP 440: Record Patterns](https://openjdk.org/jeps/440) +* [JEP 441: Pattern Matching for switch](https://openjdk.org/jeps/441) + +PMD also supports the following preview language features: + +* [JEP 430: String Templates (Preview)](https://openjdk.org/jeps/430) +* [JEP 443: Unnamed Patterns and Variables (Preview)](https://openjdk.org/jeps/443) +* [JEP 445: Unnamed Classes and Instance Main Methods (Preview)](https://openjdk.org/jeps/445) + +In order to analyze a project with PMD that uses these language features, +you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language +version `21-preview`: + + export PMD_JAVA_OPTS=--enable-preview + pmd check --use-version java-21-preview ... + +Note: Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available. + ### Changed: JavaScript support The JS specific parser options have been removed. The parser now always retains comments and uses version ES6.