getPermittedSubclasses() {
ASTPermitsList permitted = getFirstChildOfType(ASTPermitsList.class);
return permitted == null
@@ -150,13 +148,11 @@ public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration {
: CollectionUtil.toList(permitted.iterator());
}
- @Experimental
public boolean isSealed() {
int modifiers = getModifiers();
return (modifiers & AccessNode.SEALED) == AccessNode.SEALED;
}
- @Experimental
public boolean isNonSealed() {
int modifiers = getModifiers();
return (modifiers & AccessNode.NON_SEALED) == AccessNode.NON_SEALED;
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTGuardedPattern.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTGuardedPattern.java
new file mode 100644
index 0000000000..457dc4363b
--- /dev/null
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTGuardedPattern.java
@@ -0,0 +1,57 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.java.ast;
+
+import net.sourceforge.pmd.annotation.Experimental;
+
+/**
+ * A guarded pattern (JDK17 Preview). This can be found
+ * in {@link ASTSwitchLabel}s.
+ *
+ *
+ *
+ * GuardedPattern ::= {@linkplain ASTPattern Pattern} "&&" {@linkplain ASTConditionalAndExpression ConditionalAndExpression}
+ *
+ *
+ *
+ * @see JEP 406: Pattern Matching for switch (Preview)
+*/
+@Experimental
+public final class ASTGuardedPattern extends AbstractJavaNode implements ASTPattern {
+
+ private int parenDepth;
+
+ ASTGuardedPattern(int id) {
+ super(id);
+ }
+
+ ASTGuardedPattern(JavaParser p, int id) {
+ super(p, id);
+ }
+
+
+ @Override
+ public Object jjtAccept(JavaParserVisitor visitor, Object data) {
+ return visitor.visit(this, data);
+ }
+
+ public ASTPattern getPattern() {
+ return (ASTPattern) getChild(0);
+ }
+
+ public JavaNode getGuard() {
+ return getChild(1);
+ }
+
+ void bumpParenDepth() {
+ parenDepth++;
+ }
+
+ @Override
+ @Experimental
+ public int getParenthesisDepth() {
+ return parenDepth;
+ }
+}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPattern.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPattern.java
index 5a2b275d2c..122f5294dc 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPattern.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPattern.java
@@ -4,9 +4,11 @@
package net.sourceforge.pmd.lang.java.ast;
+import net.sourceforge.pmd.annotation.Experimental;
+
/**
- * A pattern (for pattern matching constructs like {@link ASTInstanceOfExpression InstanceOfExpression}).
- * This is a JDK 16 feature.
+ * A pattern (for pattern matching constructs like {@link ASTInstanceOfExpression InstanceOfExpression}
+ * or within a {@link ASTSwitchLabel}). This is a JDK 16 feature.
*
* This interface will be implemented by all forms of patterns. For
* now, only type test patterns are supported. Record deconstruction
@@ -14,7 +16,8 @@ package net.sourceforge.pmd.lang.java.ast;
*
*
*
- * Pattern ::= {@link ASTTypePattern TypePattern}
+ * Pattern ::= {@link ASTTypePattern TypePattern}
+ * | {@link ASTGuardedPattern GuardedPattern}
*
*
*
@@ -22,4 +25,10 @@ package net.sourceforge.pmd.lang.java.ast;
*/
public interface ASTPattern extends JavaNode {
+ /**
+ * Returns the number of parenthesis levels around this pattern.
+ * If this method returns 0, then no parentheses are present.
+ */
+ @Experimental
+ int getParenthesisDepth();
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermitsList.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermitsList.java
index baa03e532b..2b386b2999 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermitsList.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermitsList.java
@@ -6,15 +6,13 @@ package net.sourceforge.pmd.lang.java.ast;
import java.util.Iterator;
-import net.sourceforge.pmd.annotation.Experimental;
-
/**
* Represents the {@code permits} clause of a (sealed) class declaration.
*
- * This is a Java 15 Preview and Java 16 Preview feature.
+ *
This is a Java 17 Feature.
*
- *
See https://openjdk.java.net/jeps/397
+ *
See https://openjdk.java.net/jeps/409
*
*
*
@@ -22,7 +20,6 @@ import net.sourceforge.pmd.annotation.Experimental;
* ( "," ClassOrInterfaceType )*
*
*/
-@Experimental
public final class ASTPermitsList extends AbstractJavaNode implements Iterable {
ASTPermitsList(int id) {
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java
index 2c7c74d576..4994d6a278 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java
@@ -6,6 +6,8 @@ package net.sourceforge.pmd.lang.java.ast;
import java.util.List;
+import net.sourceforge.pmd.annotation.Experimental;
+
/**
* A type pattern (JDK16). This can be found on
* the right-hand side of an {@link ASTInstanceOfExpression InstanceOfExpression}.
@@ -21,6 +23,7 @@ import java.util.List;
public final class ASTTypePattern extends AbstractJavaAnnotatableNode implements ASTPattern {
private boolean isFinal;
+ private int parenDepth;
ASTTypePattern(int id) {
super(id);
@@ -60,4 +63,14 @@ public final class ASTTypePattern extends AbstractJavaAnnotatableNode implements
boolean isFinal() {
return isFinal;
}
+
+ void bumpParenDepth() {
+ parenDepth++;
+ }
+
+ @Override
+ @Experimental
+ public int getParenthesisDepth() {
+ return parenDepth;
+ }
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AstImplUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AstImplUtil.java
new file mode 100644
index 0000000000..beef16084a
--- /dev/null
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AstImplUtil.java
@@ -0,0 +1,25 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.java.ast;
+
+/**
+ * KEEP PRIVATE
+ */
+final class AstImplUtil {
+
+ private AstImplUtil() {
+ }
+
+ static void bumpParenDepth(ASTPattern pattern) {
+ assert pattern instanceof ASTTypePattern || pattern instanceof ASTGuardedPattern
+ : pattern.getClass() + " doesn't have parenDepth attribute!";
+
+ if (pattern instanceof ASTTypePattern) {
+ ((ASTTypePattern) pattern).bumpParenDepth();
+ } else if (pattern instanceof ASTGuardedPattern) {
+ ((ASTGuardedPattern) pattern).bumpParenDepth();
+ }
+ }
+}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java
index af9900b450..00cf32dd3a 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java
@@ -938,9 +938,15 @@ public class JavaParserDecoratedVisitor implements JavaParserVisitor {
}
@Override
- @Experimental
public Object visit(ASTPermitsList node, Object data) {
visitor.visit(node, data);
return visit((JavaNode) node, data);
}
+
+ @Experimental
+ @Override
+ public Object visit(ASTGuardedPattern node, Object data) {
+ visitor.visit(node, data);
+ return visit((JavaNode) node, data);
+ }
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java
index d0edd71373..5b1205cd46 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java
@@ -659,8 +659,13 @@ public class JavaParserVisitorAdapter implements JavaParserVisitor {
}
@Override
- @Experimental
public Object visit(ASTPermitsList node, Object data) {
return visit((JavaNode) node, data);
}
+
+ @Experimental
+ @Override
+ public Object visit(ASTGuardedPattern node, Object data) {
+ return visit((JavaNode) node, data);
+ }
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java
index 7e38503674..03f8eb703a 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java
@@ -791,8 +791,13 @@ public class JavaParserVisitorDecorator implements JavaParserControllessVisitor
}
@Override
- @Experimental
public Object visit(ASTPermitsList node, Object data) {
return visitor.visit(node, data);
}
+
+ @Experimental
+ @Override
+ public Object visit(ASTGuardedPattern node, Object data) {
+ return visitor.visit(node, data);
+ }
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java
index 41e7e6c924..0a92976605 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java
@@ -60,6 +60,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTForStatement;
import net.sourceforge.pmd.lang.java.ast.ASTForUpdate;
import net.sourceforge.pmd.lang.java.ast.ASTFormalParameter;
import net.sourceforge.pmd.lang.java.ast.ASTFormalParameters;
+import net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern;
import net.sourceforge.pmd.lang.java.ast.ASTIfStatement;
import net.sourceforge.pmd.lang.java.ast.ASTImplementsList;
import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration;
@@ -868,8 +869,13 @@ public abstract class AbstractJavaRule extends AbstractRule implements JavaParse
}
@Override
- @Experimental
public Object visit(ASTPermitsList node, Object data) {
return visit((JavaNode) node, data);
}
+
+ @Experimental
+ @Override
+ public Object visit(ASTGuardedPattern node, Object data) {
+ return visit((JavaNode) node, data);
+ }
}
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/LanguageVersionTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/LanguageVersionTest.java
index 6079eb9067..286f5bc959 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/LanguageVersionTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/LanguageVersionTest.java
@@ -42,24 +42,20 @@ public class LanguageVersionTest extends AbstractLanguageVersionTest {
LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("11"), },
{ JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "12",
LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("12"), },
- { JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "12-preview",
- LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("12-preview"), },
{ JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "13",
LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("13"), },
- { JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "13-preview",
- LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("13-preview"), },
{ JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "14",
LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("14"), },
- { JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "14-preview",
- LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("14-preview"), },
{ JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "15",
LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("15"), },
- { JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "15-preview",
- LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("15-preview"), },
{ JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "16",
LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("16"), },
{ JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "16-preview",
LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("16-preview"), },
+ { JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "17",
+ LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("17"), },
+ { JavaLanguageModule.NAME, JavaLanguageModule.TERSE_NAME, "17-preview",
+ LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("17-preview"), },
// this one won't be found: case sensitive!
{ "JAVA", "JAVA", "1.7", null, },
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/coverage/PMDCoverageTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/coverage/PMDCoverageTest.java
index 895622d698..99f534b543 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/coverage/PMDCoverageTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/coverage/PMDCoverageTest.java
@@ -11,35 +11,51 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.contrib.java.lang.system.StandardErrorStreamLog;
-import org.junit.contrib.java.lang.system.StandardOutputStreamLog;
+import org.junit.contrib.java.lang.system.SystemErrRule;
+import org.junit.contrib.java.lang.system.SystemOutRule;
import org.junit.rules.TemporaryFolder;
import net.sourceforge.pmd.PMD;
+import net.sourceforge.pmd.lang.LanguageRegistry;
+import net.sourceforge.pmd.lang.LanguageVersion;
+import net.sourceforge.pmd.lang.java.JavaLanguageModule;
public class PMDCoverageTest {
@Rule
- public StandardOutputStreamLog output = new StandardOutputStreamLog();
+ public SystemOutRule output = new SystemOutRule().muteForSuccessfulTests().enableLog();
@Rule
- public StandardErrorStreamLog errorStream = new StandardErrorStreamLog();
+ public SystemErrRule errorStream = new SystemErrRule().muteForSuccessfulTests().enableLog();
@Rule
public TemporaryFolder folder = new TemporaryFolder();
- /**
- * Test some of the PMD command line options
- */
@Test
public void testPmdOptions() {
- runPmd("-d src/main/java/net/sourceforge/pmd/lang/java/rule/design -f text -R rulesets/internal/all-java.xml -language java -stress -benchmark");
+ runPmd("-d src/main/java/net/sourceforge/pmd/lang/java/rule/design -f text -R rulesets/internal/all-java.xml -stress -benchmark");
+ }
+
+
+ @Test
+ public void runAllJavaPmdOnSourceTree() {
+ runPmd("-d src/main/java -f text -R rulesets/internal/all-java.xml");
+ }
+
+ @Test
+ public void runAllJavaPmdOnTestResourcesWithLatestJavaVersion() {
+ List versions = LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersions();
+ LanguageVersion latest = versions.get(versions.size() - 1);
+
+ runPmd("-d src/test/resources -f text -R rulesets/internal/all-java.xml -language java -version " + latest.getVersion());
}
/**
@@ -49,8 +65,10 @@ public class PMDCoverageTest {
*/
private void runPmd(String commandLine) {
String[] args = commandLine.split("\\s");
+ String report = "missing report";
try {
+
File f = folder.newFile();
args = ArrayUtils.addAll(
args,
@@ -60,27 +78,26 @@ public class PMDCoverageTest {
String.valueOf(Runtime.getRuntime().availableProcessors())
);
+ System.err.println("Running PMD with: " + Arrays.toString(args));
PMD.runPmd(args);
+ report = FileUtils.readFileToString(f, StandardCharsets.UTF_8);
assertEquals("Nothing should be output to stdout", 0, output.getLog().length());
-
assertEquals("No exceptions expected", 0, StringUtils.countMatches(errorStream.getLog(), "Exception applying rule"));
assertFalse("Wrong configuration? Ruleset not found", errorStream.getLog().contains("Ruleset not found"));
assertEquals("No usage of deprecated XPath attributes expected", 0, StringUtils.countMatches(errorStream.getLog(), "Use of deprecated attribute"));
- String report = FileUtils.readFileToString(f, StandardCharsets.UTF_8);
assertEquals("No processing errors expected", 0, StringUtils.countMatches(report, "Error while processing"));
// we might have explicit examples of parsing errors, so these are maybe false positives
assertEquals("No parsing error expected", 0, StringUtils.countMatches(report, "Error while parsing"));
} catch (IOException ioe) {
fail("Problem creating temporary file: " + ioe.getLocalizedMessage());
+ } catch (AssertionError ae) {
+ System.out.println("\nReport:\n");
+ System.out.println(report);
+ throw ae;
}
}
-
- @Test
- public void runAllJavaPmdOnSourceTree() {
- runPmd("-d src/main/java -f text -R rulesets/internal/all-java.xml -language java");
- }
}
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15PreviewTreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15PreviewTreeDumpTest.java
deleted file mode 100644
index 739aedf86e..0000000000
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15PreviewTreeDumpTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.java.ast;
-
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import net.sourceforge.pmd.lang.ast.ParseException;
-import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper;
-import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest;
-import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter;
-import net.sourceforge.pmd.lang.java.JavaParsingHelper;
-
-public class Java15PreviewTreeDumpTest extends BaseTreeDumpTest {
- private final JavaParsingHelper java15p =
- JavaParsingHelper.WITH_PROCESSING.withDefaultVersion("15-preview")
- .withResourceContext(Java15PreviewTreeDumpTest.class, "jdkversiontests/java15p/");
- private final JavaParsingHelper java15 = java15p.withDefaultVersion("15");
-
- public Java15PreviewTreeDumpTest() {
- super(new RelevantAttributePrinter(), ".java");
- }
-
- @Override
- public BaseParsingHelper, ?> getParser() {
- return java15p;
- }
-
- @Test
- public void patternMatchingInstanceof() {
- doTest("PatternMatchingInstanceof");
-
- // extended tests for type resolution etc.
- ASTCompilationUnit compilationUnit = java15p.parseResource("PatternMatchingInstanceof.java");
- List instanceOfExpressions = compilationUnit.findDescendantsOfType(ASTInstanceOfExpression.class);
- for (ASTInstanceOfExpression expr : instanceOfExpressions) {
- ASTVariableDeclaratorId variable = expr.getChild(1).getFirstChildOfType(ASTVariableDeclaratorId.class);
- Assert.assertEquals(String.class, variable.getType());
- // Note: these variables are not part of the symbol table
- // See ScopeAndDeclarationFinder#visit(ASTVariableDeclaratorId, Object)
- Assert.assertNull(variable.getNameDeclaration());
- }
- }
-
- @Test(expected = ParseException.class)
- public void patternMatchingInstanceofBeforeJava15PreviewShouldFail() {
- java15.parseResource("PatternMatchingInstanceof.java");
- }
-
- @Test
- public void recordPoint() {
- doTest("Point");
-
- // extended tests for type resolution etc.
- ASTCompilationUnit compilationUnit = java15p.parseResource("Point.java");
- ASTRecordDeclaration recordDecl = compilationUnit.getFirstDescendantOfType(ASTRecordDeclaration.class);
- List components = recordDecl.getFirstChildOfType(ASTRecordComponentList.class)
- .findChildrenOfType(ASTRecordComponent.class);
- Assert.assertNull(components.get(0).getVarId().getNameDeclaration().getAccessNodeParent());
- Assert.assertEquals(Integer.TYPE, components.get(0).getVarId().getNameDeclaration().getType());
- Assert.assertEquals("int", components.get(0).getVarId().getNameDeclaration().getTypeImage());
- }
-
- @Test(expected = ParseException.class)
- public void recordPointBeforeJava15PreviewShouldFail() {
- java15.parseResource("Point.java");
- }
-
- @Test(expected = ParseException.class)
- public void recordCtorWithThrowsShouldFail() {
- java15p.parse(" record R {"
- + " R throws IOException {}"
- + " }");
- }
-
- @Test(expected = ParseException.class)
- public void recordMustNotExtend() {
- java15p.parse("record RecordEx(int x) extends Number { }");
- }
-
- @Test
- public void innerRecords() {
- doTest("Records");
- }
-
- @Test(expected = ParseException.class)
- public void recordIsARestrictedIdentifier() {
- java15p.parse("public class record {}");
- }
-
- @Test
- public void localRecords() {
- doTest("LocalRecords");
- }
-
- @Test(expected = ParseException.class)
- public void sealedClassBeforeJava15Preview() {
- java15.parseResource("geometry/Shape.java");
- }
-
- @Test
- public void sealedClass() {
- doTest("geometry/Shape");
- }
-
- @Test
- public void nonSealedClass() {
- doTest("geometry/Square");
- }
-
- @Test(expected = ParseException.class)
- public void sealedInterfaceBeforeJava15Preview() {
- java15.parseResource("expression/Expr.java");
- }
-
- @Test
- public void sealedInterface() {
- doTest("expression/Expr");
- }
-
- @Test
- public void localInterfaceAndEnums() {
- doTest("LocalInterfacesAndEnums");
- }
-
- @Test(expected = ParseException.class)
- public void localInterfacesAndEnumsBeforeJava15PreviewShouldFail() {
- java15.parseResource("LocalInterfacesAndEnums.java");
- }
-}
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15TreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15TreeDumpTest.java
index bed127076d..7cc0c057e6 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15TreeDumpTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15TreeDumpTest.java
@@ -16,7 +16,6 @@ public class Java15TreeDumpTest extends BaseTreeDumpTest {
private final JavaParsingHelper java15 =
JavaParsingHelper.WITH_PROCESSING.withDefaultVersion("15")
.withResourceContext(Java15TreeDumpTest.class, "jdkversiontests/java15/");
- private final JavaParsingHelper java15p = java15.withDefaultVersion("15-preview");
private final JavaParsingHelper java14 = java15.withDefaultVersion("14");
public Java15TreeDumpTest() {
@@ -31,7 +30,6 @@ public class Java15TreeDumpTest extends BaseTreeDumpTest {
@Test
public void textBlocks() {
doTest("TextBlocks");
- java15p.parseResource("TextBlocks.java"); // make sure we can parse it with preview as well
}
@Test(expected = net.sourceforge.pmd.lang.ast.ParseException.class)
@@ -47,6 +45,5 @@ public class Java15TreeDumpTest extends BaseTreeDumpTest {
@Test
public void sealedAndNonSealedIdentifiers() {
doTest("NonSealedIdentifier");
- java15p.parseResource("NonSealedIdentifier.java"); // make sure we can parse it with preview as well
}
}
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java16TreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java16TreeDumpTest.java
index ca809cc0e7..a6b9cbe848 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java16TreeDumpTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java16TreeDumpTest.java
@@ -18,7 +18,7 @@ import net.sourceforge.pmd.lang.java.JavaParsingHelper;
public class Java16TreeDumpTest extends BaseTreeDumpTest {
private final JavaParsingHelper java16 =
JavaParsingHelper.WITH_PROCESSING.withDefaultVersion("16")
- .withResourceContext(Java15TreeDumpTest.class, "jdkversiontests/java16/");
+ .withResourceContext(Java16TreeDumpTest.class, "jdkversiontests/java16/");
private final JavaParsingHelper java16p = java16.withDefaultVersion("16-preview");
private final JavaParsingHelper java15 = java16.withDefaultVersion("15");
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17PreviewTreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17PreviewTreeDumpTest.java
new file mode 100644
index 0000000000..ce7d7d779b
--- /dev/null
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17PreviewTreeDumpTest.java
@@ -0,0 +1,92 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.java.ast;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.function.ThrowingRunnable;
+
+import net.sourceforge.pmd.lang.ast.ParseException;
+import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper;
+import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest;
+import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter;
+import net.sourceforge.pmd.lang.java.JavaParsingHelper;
+
+public class Java17PreviewTreeDumpTest extends BaseTreeDumpTest {
+ private final JavaParsingHelper java17p =
+ JavaParsingHelper.WITH_PROCESSING.withDefaultVersion("17-preview")
+ .withResourceContext(Java17PreviewTreeDumpTest.class, "jdkversiontests/java17p/");
+ private final JavaParsingHelper java17 = java17p.withDefaultVersion("17");
+
+ public Java17PreviewTreeDumpTest() {
+ super(new RelevantAttributePrinter(), ".java");
+ }
+
+ @Override
+ public BaseParsingHelper, ?> getParser() {
+ return java17p;
+ }
+
+ @Test
+ public void patternMatchingForSwitchBeforeJava17Preview() {
+ ParseException thrown = Assert.assertThrows(ParseException.class, new ThrowingRunnable() {
+ @Override
+ public void run() throws Throwable {
+ java17.parseResource("PatternsInSwitchLabels.java");
+ }
+ });
+ Assert.assertTrue("Unexpected message: " + thrown.getMessage(),
+ thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 17 Preview."));
+ }
+
+ @Test
+ public void patternMatchingForSwitch() {
+ doTest("PatternsInSwitchLabels");
+ }
+
+ @Test
+ public void enhancedTypeCheckingSwitch() {
+ doTest("EnhancedTypeCheckingSwitch");
+ }
+
+ @Test
+ public void scopeOfPatternVariableDeclarations() {
+ doTest("ScopeOfPatternVariableDeclarations");
+ }
+
+ @Test
+ public void dealingWithNullBeforeJava17Preview() {
+ ParseException thrown = Assert.assertThrows(ParseException.class, new ThrowingRunnable() {
+ @Override
+ public void run() throws Throwable {
+ java17.parseResource("DealingWithNull.java");
+ }
+ });
+ Assert.assertTrue("Unexpected message: " + thrown.getMessage(),
+ thrown.getMessage().contains("Null case labels in switch are only supported with JDK 17 Preview."));
+ }
+
+ @Test
+ public void dealingWithNull() {
+ doTest("DealingWithNull");
+ }
+
+ @Test
+ public void guardedAndParenthesizedPatternsBeforeJava17Preview() {
+ ParseException thrown = Assert.assertThrows(ParseException.class, new ThrowingRunnable() {
+ @Override
+ public void run() throws Throwable {
+ java17.parseResource("GuardedAndParenthesizedPatterns.java");
+ }
+ });
+ Assert.assertTrue("Unexpected message: " + thrown.getMessage(),
+ thrown.getMessage().contains("Guarded patterns are only supported with JDK 17 Preview."));
+ }
+
+ @Test
+ public void guardedAndParenthesizedPatterns() {
+ doTest("GuardedAndParenthesizedPatterns");
+ }
+}
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17TreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17TreeDumpTest.java
new file mode 100644
index 0000000000..6dd38772ac
--- /dev/null
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17TreeDumpTest.java
@@ -0,0 +1,79 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.java.ast;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.function.ThrowingRunnable;
+
+import net.sourceforge.pmd.lang.ast.ParseException;
+import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper;
+import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest;
+import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter;
+import net.sourceforge.pmd.lang.java.JavaParsingHelper;
+
+public class Java17TreeDumpTest extends BaseTreeDumpTest {
+ private final JavaParsingHelper java17 =
+ JavaParsingHelper.WITH_PROCESSING.withDefaultVersion("17")
+ .withResourceContext(Java17TreeDumpTest.class, "jdkversiontests/java17/");
+ private final JavaParsingHelper java17p = java17.withDefaultVersion("17-preview");
+ private final JavaParsingHelper java16 = java17.withDefaultVersion("16");
+
+ public Java17TreeDumpTest() {
+ super(new RelevantAttributePrinter(), ".java");
+ }
+
+ @Override
+ public BaseParsingHelper, ?> getParser() {
+ return java17;
+ }
+
+ @Test
+ public void sealedClassBeforeJava17() {
+ ParseException thrown = Assert.assertThrows(ParseException.class, new ThrowingRunnable() {
+ @Override
+ public void run() throws Throwable {
+ java16.parseResource("geometry/Shape.java");
+ }
+ });
+ Assert.assertTrue("Unexpected message: " + thrown.getMessage(),
+ thrown.getMessage().contains("Sealed Classes are only supported with JDK 16 Preview and JDK >= 17."));
+ }
+
+ @Test
+ public void sealedClass() {
+ doTest("geometry/Shape");
+ java17p.parseResource("geometry/Shape.java"); // make sure we can parse it with preview as well
+ }
+
+ @Test
+ public void nonSealedClass() {
+ doTest("geometry/Square");
+ java17p.parseResource("geometry/Square.java"); // make sure we can parse it with preview as well
+ }
+
+ @Test
+ public void sealedInterfaceBeforeJava17() {
+ ParseException thrown = Assert.assertThrows(ParseException.class, new ThrowingRunnable() {
+ @Override
+ public void run() throws Throwable {
+ java16.parseResource("expression/Expr.java");
+ }
+ });
+ Assert.assertTrue("Unexpected message: " + thrown.getMessage(),
+ thrown.getMessage().contains("Sealed Classes are only supported with JDK 16 Preview and JDK >= 17."));
+ }
+
+ @Test
+ public void sealedInterface() {
+ doTest("expression/Expr");
+ java17p.parseResource("expression/Expr.java"); // make sure we can parse it with preview as well
+ }
+
+ @Test
+ public void localVars() {
+ doTest("LocalVars");
+ }
+}
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java
index f545446d84..66ad5d08d8 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java
@@ -186,7 +186,7 @@ public class ParserCornersTest {
public void testGitHubBug2767() {
// PMD fails to parse an initializer block.
// PMD 6.26.0 parses this code just fine.
- java.withDefaultVersion("15-preview")
+ java.withDefaultVersion("16")
.parse("class Foo {\n"
+ " {final int I;}\n"
+ "}\n");
diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt
index 1ac7c8161e..4d01bc1f4a 100644
--- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt
+++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt
@@ -12,16 +12,16 @@ import java.io.IOException
class ASTPatternTest : ParserTestSpec({
- parserTest("Test patterns only available on JDK 15 (preview) and JDK16 and JDK16 (preview)",
- javaVersions = JavaVersion.values().asList().minus(J15__PREVIEW).minus(J16).minus(J16__PREVIEW)) {
+ parserTest("Test patterns only available on JDK16 and JDK16 (preview) and JDK17 and JDK 17 (preview)",
+ javaVersions = JavaVersion.values().asList().minus(J16).minus(J16__PREVIEW).minus(J17).minus(J17__PREVIEW)) {
- expectParseException("Pattern Matching for instanceof is only supported with Java 15 Preview and Java >= 16") {
+ expectParseException("Pattern Matching for instanceof is only supported with JDK >= 16") {
parseAstExpression("obj instanceof Class c")
}
}
- parserTest("Test simple patterns", javaVersions = listOf(J15__PREVIEW, J16)) {
+ parserTest("Test simple patterns", javaVersions = listOf(J16, J17)) {
importedTypes += IOException::class.java
diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/KotlinTestingDsl.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/KotlinTestingDsl.kt
index b8970f2e9c..ce4e63419b 100644
--- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/KotlinTestingDsl.kt
+++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/KotlinTestingDsl.kt
@@ -21,8 +21,9 @@ enum class JavaVersion : Comparable {
J12,
J13,
J14,
- J15, J15__PREVIEW,
- J16, J16__PREVIEW;
+ J15,
+ J16, J16__PREVIEW,
+ J17, J17__PREVIEW;
/** Name suitable for use with e.g. [JavaParsingHelper.parse] */
val pmdName: String = name.removePrefix("J").replaceFirst("__", "-").replace('_', '.').toLowerCase()
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalInterfacesAndEnums.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalInterfacesAndEnums.java
deleted file mode 100644
index cbc20db232..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalInterfacesAndEnums.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-public class LocalInterfacesAndEnums {
-
- {
- class MyLocalClass {}
-
- // static local classes are not allowed (neither Java15 nor Java15 Preview)
- //static class MyLocalStaticClass {}
-
- interface MyLocalInterface {}
-
- enum MyLocalEnum { A }
-
- // not supported anymore with Java16
- //@interface MyLocalAnnotation {}
- }
-}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalInterfacesAndEnums.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalInterfacesAndEnums.txt
deleted file mode 100644
index 6c470f7744..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalInterfacesAndEnums.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
- +- TypeDeclaration[]
- +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "LocalInterfacesAndEnums", @Default = false, @Final = false, @Image = "LocalInterfacesAndEnums", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "LocalInterfacesAndEnums", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
- +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.INITIALIZER]
- +- Initializer[@Static = false]
- +- Block[@containsComment = true]
- +- BlockStatement[@Allocation = false]
- | +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "LocalInterfacesAndEnums$1MyLocalClass", @Default = false, @Final = false, @Image = "MyLocalClass", @Interface = false, @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = false, @Sealed = false, @SimpleName = "MyLocalClass", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
- | +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- BlockStatement[@Allocation = false]
- | +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "LocalInterfacesAndEnums$1MyLocalInterface", @Default = false, @Final = false, @Image = "MyLocalInterface", @Interface = true, @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = false, @Sealed = false, @SimpleName = "MyLocalInterface", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.INTERFACE, @Volatile = false]
- | +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- BlockStatement[@Allocation = false]
- +- EnumDeclaration[@Abstract = false, @BinaryName = "LocalInterfacesAndEnums$MyLocalEnum", @Default = false, @Final = false, @Image = "MyLocalEnum", @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyLocalEnum", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.ENUM, @Volatile = false]
- +- EnumBody[]
- +- EnumConstant[@AnonymousClass = false, @Image = "A"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalRecords.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalRecords.java
deleted file mode 100644
index b860e99136..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalRecords.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-import java.util.stream.Collectors;
-import java.util.List;
-
-/**
- * @see JEP 384: Records (Second Preview)
- */
-public class LocalRecords {
- public interface Merchant {}
- public static double computeSales(Merchant merchant, int month) {
- return month;
- }
- List findTopMerchants(List merchants, int month) {
- // Local record
- record MerchantSales(Merchant merchant, double sales) {}
-
- return merchants.stream()
- .map(merchant -> new MerchantSales(merchant, computeSales(merchant, month)))
- .sorted((m1, m2) -> Double.compare(m2.sales(), m1.sales()))
- .map(MerchantSales::merchant)
- .collect(Collectors.toList());
- }
-
- void methodWithLocalRecordAndModifiers() {
- final record MyRecord1(String a) {}
- final static record MyRecord2(String a) {}
- @Deprecated record MyRecord3(String a) {}
- final @Deprecated static record MyRecord4(String a) {}
- }
-
- void statementThatStartsWithRecordAsRegularIdent() {
- // https://github.com/pmd/pmd/issues/3145
- final Map record = new HashMap<>();
- record.put("key", "value");
- }
-
- void methodWithLocalClass() {
- class MyLocalClass {}
- }
-
- void methodWithLocalVarsNamedSealed() {
- int result = 0;
- int non = 1;
- int sealed = 2;
- result = non-sealed;
- System.out.println(result);
- }
-}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalRecords.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalRecords.txt
deleted file mode 100644
index 39aa674f21..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/LocalRecords.txt
+++ /dev/null
@@ -1,337 +0,0 @@
-+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
- +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.stream.Collectors", @ImportedSimpleName = "Collectors", @PackageName = "java.util.stream", @Static = false]
- | +- Name[@Image = "java.util.stream.Collectors"]
- +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.List", @ImportedSimpleName = "List", @PackageName = "java.util", @Static = false]
- | +- Name[@Image = "java.util.List"]
- +- TypeDeclaration[]
- +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "LocalRecords", @Default = false, @Final = false, @Image = "LocalRecords", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "LocalRecords", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
- +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.INTERFACE]
- | +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "LocalRecords$Merchant", @Default = false, @Final = false, @Image = "Merchant", @Interface = true, @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "Merchant", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.INTERFACE, @Volatile = false]
- | +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 2, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "computeSales", @Modifiers = 17, @Name = "computeSales", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = false, @Volatile = false]
- | +- ResultType[@Void = false, @returnsArray = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "double"]
- | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "double"]
- | +- MethodDeclarator[@Image = "computeSales", @ParameterCount = 2]
- | | +- FormalParameters[@ParameterCount = 2, @Size = 2]
- | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Merchant"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Merchant", @ReferenceToClassSameCompilationUnit = true]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "merchant", @LambdaParameter = false, @LocalVariable = false, @Name = "merchant", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "merchant"]
- | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "month", @LambdaParameter = false, @LocalVariable = false, @Name = "month", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "month"]
- | +- Block[@containsComment = false]
- | +- BlockStatement[@Allocation = false]
- | +- Statement[]
- | +- ReturnStatement[]
- | +- Expression[@StandAlonePrimitive = false]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Name[@Image = "month"]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 2, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "findTopMerchants", @Modifiers = 0, @Name = "findTopMerchants", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = false, @Volatile = false]
- | +- ResultType[@Void = false, @returnsArray = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "List"]
- | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "List", @ReferenceToClassSameCompilationUnit = false]
- | | +- TypeArguments[@Diamond = false]
- | | +- TypeArgument[@Wildcard = false]
- | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Merchant", @ReferenceToClassSameCompilationUnit = true]
- | +- MethodDeclarator[@Image = "findTopMerchants", @ParameterCount = 2]
- | | +- FormalParameters[@ParameterCount = 2, @Size = 2]
- | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "List"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "List", @ReferenceToClassSameCompilationUnit = false]
- | | | | +- TypeArguments[@Diamond = false]
- | | | | +- TypeArgument[@Wildcard = false]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Merchant", @ReferenceToClassSameCompilationUnit = true]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "merchants", @LambdaParameter = false, @LocalVariable = false, @Name = "merchants", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "merchants"]
- | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "month", @LambdaParameter = false, @LocalVariable = false, @Name = "month", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "month"]
- | +- Block[@containsComment = false]
- | +- BlockStatement[@Allocation = false]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MerchantSales", @Default = false, @Final = true, @Image = "MerchantSales", @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MerchantSales", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | | +- RecordComponentList[@Size = 2]
- | | | +- RecordComponent[@Varargs = false]
- | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Merchant"]
- | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Merchant", @ReferenceToClassSameCompilationUnit = true]
- | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "merchant", @LambdaParameter = false, @LocalVariable = false, @Name = "merchant", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "merchant"]
- | | | +- RecordComponent[@Varargs = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "double"]
- | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "double"]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "sales", @LambdaParameter = false, @LocalVariable = false, @Name = "sales", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "sales"]
- | | +- RecordBody[]
- | +- BlockStatement[@Allocation = false]
- | +- Statement[]
- | +- ReturnStatement[]
- | +- Expression[@StandAlonePrimitive = false]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "merchants.stream"]
- | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 0, @Size = 0]
- | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "map"]
- | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | +- ArgumentList[@Size = 1]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- LambdaExpression[@Abstract = false, @Default = false, @Final = false, @Kind = MethodLikeKind.LAMBDA, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @Volatile = false]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "merchant", @LambdaParameter = true, @LocalVariable = false, @Name = "merchant", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = true, @VariableName = "merchant"]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- AllocationExpression[@AnonymousClass = false]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "MerchantSales", @ReferenceToClassSameCompilationUnit = false]
- | | +- Arguments[@ArgumentCount = 2, @Size = 2]
- | | +- ArgumentList[@Size = 2]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "merchant"]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "computeSales"]
- | | +- PrimarySuffix[@ArgumentCount = 2, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 2, @Size = 2]
- | | +- ArgumentList[@Size = 2]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "merchant"]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "month"]
- | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "sorted"]
- | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | +- ArgumentList[@Size = 1]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- LambdaExpression[@Abstract = false, @Default = false, @Final = false, @Kind = MethodLikeKind.LAMBDA, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @Volatile = false]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "m1", @LambdaParameter = true, @LocalVariable = false, @Name = "m1", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = true, @VariableName = "m1"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "m2", @LambdaParameter = true, @LocalVariable = false, @Name = "m2", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = true, @VariableName = "m2"]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "Double.compare"]
- | | +- PrimarySuffix[@ArgumentCount = 2, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 2, @Size = 2]
- | | +- ArgumentList[@Size = 2]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "m2.sales"]
- | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
- | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "m1.sales"]
- | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 0, @Size = 0]
- | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "map"]
- | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | +- ArgumentList[@Size = 1]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "MerchantSales"]
- | | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false]
- | | +- MemberSelector[]
- | | +- MethodReference[@Image = "merchant"]
- | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "collect"]
- | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | +- ArgumentList[@Size = 1]
- | +- Expression[@StandAlonePrimitive = false]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "Collectors.toList"]
- | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
- | +- Arguments[@ArgumentCount = 0, @Size = 0]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "methodWithLocalRecordAndModifiers", @Modifiers = 0, @Name = "methodWithLocalRecordAndModifiers", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
- | +- ResultType[@Void = true, @returnsArray = false]
- | +- MethodDeclarator[@Image = "methodWithLocalRecordAndModifiers", @ParameterCount = 0]
- | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | +- Block[@containsComment = false]
- | +- BlockStatement[@Allocation = false]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord1", @Default = false, @Final = true, @Image = "MyRecord1", @Local = true, @Modifiers = 32, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord1", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | | +- RecordComponentList[@Size = 1]
- | | | +- RecordComponent[@Varargs = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "a", @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "a"]
- | | +- RecordBody[]
- | +- BlockStatement[@Allocation = false]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord2", @Default = false, @Final = true, @Image = "MyRecord2", @Local = true, @Modifiers = 48, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord2", @Static = true, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | | +- RecordComponentList[@Size = 1]
- | | | +- RecordComponent[@Varargs = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "a", @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "a"]
- | | +- RecordBody[]
- | +- BlockStatement[@Allocation = false]
- | | +- Annotation[@AnnotationName = "Deprecated"]
- | | | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
- | | | +- Name[@Image = "Deprecated"]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord3", @Default = false, @Final = true, @Image = "MyRecord3", @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord3", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | | +- RecordComponentList[@Size = 1]
- | | | +- RecordComponent[@Varargs = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "a", @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "a"]
- | | +- RecordBody[]
- | +- BlockStatement[@Allocation = false]
- | +- Annotation[@AnnotationName = "Deprecated"]
- | | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
- | | +- Name[@Image = "Deprecated"]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord4", @Default = false, @Final = true, @Image = "MyRecord4", @Local = true, @Modifiers = 48, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord4", @Static = true, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | +- RecordComponentList[@Size = 1]
- | | +- RecordComponent[@Varargs = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "a", @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "a"]
- | +- RecordBody[]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "statementThatStartsWithRecordAsRegularIdent", @Modifiers = 0, @Name = "statementThatStartsWithRecordAsRegularIdent", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
- | +- ResultType[@Void = true, @returnsArray = false]
- | +- MethodDeclarator[@Image = "statementThatStartsWithRecordAsRegularIdent", @ParameterCount = 0]
- | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | +- Block[@containsComment = false]
- | +- BlockStatement[@Allocation = true]
- | | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = true, @Modifiers = 32, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "record", @Volatile = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Map"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Map", @ReferenceToClassSameCompilationUnit = false]
- | | | +- TypeArguments[@Diamond = false]
- | | | +- TypeArgument[@Wildcard = false]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- TypeArgument[@Wildcard = false]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | +- VariableDeclarator[@Initializer = true, @Name = "record"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "record", @LambdaParameter = false, @LocalVariable = true, @Name = "record", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "record"]
- | | +- VariableInitializer[]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- AllocationExpression[@AnonymousClass = false]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "HashMap", @ReferenceToClassSameCompilationUnit = false]
- | | | +- TypeArguments[@Diamond = true]
- | | +- Arguments[@ArgumentCount = 0, @Size = 0]
- | +- BlockStatement[@Allocation = false]
- | +- Statement[]
- | +- StatementExpression[]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "record.put"]
- | +- PrimarySuffix[@ArgumentCount = 2, @Arguments = true, @ArrayDereference = false]
- | +- Arguments[@ArgumentCount = 2, @Size = 2]
- | +- ArgumentList[@Size = 2]
- | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""key"", @FloatLiteral = false, @Image = ""key"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""key"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | +- Expression[@StandAlonePrimitive = false]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""value"", @FloatLiteral = false, @Image = ""value"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""value"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "methodWithLocalClass", @Modifiers = 0, @Name = "methodWithLocalClass", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
- | +- ResultType[@Void = true, @returnsArray = false]
- | +- MethodDeclarator[@Image = "methodWithLocalClass", @ParameterCount = 0]
- | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | +- Block[@containsComment = false]
- | +- BlockStatement[@Allocation = false]
- | +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "LocalRecords$1MyLocalClass", @Default = false, @Final = false, @Image = "MyLocalClass", @Interface = false, @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = false, @Sealed = false, @SimpleName = "MyLocalClass", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
- | +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "methodWithLocalVarsNamedSealed", @Modifiers = 0, @Name = "methodWithLocalVarsNamedSealed", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
- +- ResultType[@Void = true, @returnsArray = false]
- +- MethodDeclarator[@Image = "methodWithLocalVarsNamedSealed", @ParameterCount = 0]
- | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- +- Block[@containsComment = false]
- +- BlockStatement[@Allocation = false]
- | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "result", @Volatile = false]
- | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | +- VariableDeclarator[@Initializer = true, @Name = "result"]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "result", @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "result"]
- | +- VariableInitializer[]
- | +- Expression[@StandAlonePrimitive = true]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "0", @FloatLiteral = false, @Image = "0", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "0", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- +- BlockStatement[@Allocation = false]
- | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "non", @Volatile = false]
- | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | +- VariableDeclarator[@Initializer = true, @Name = "non"]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "non", @LambdaParameter = false, @LocalVariable = true, @Name = "non", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "non"]
- | +- VariableInitializer[]
- | +- Expression[@StandAlonePrimitive = true]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "1", @FloatLiteral = false, @Image = "1", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "1", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 1, @ValueAsLong = 1]
- +- BlockStatement[@Allocation = false]
- | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "sealed", @Volatile = false]
- | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | +- VariableDeclarator[@Initializer = true, @Name = "sealed"]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "sealed", @LambdaParameter = false, @LocalVariable = true, @Name = "sealed", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "sealed"]
- | +- VariableInitializer[]
- | +- Expression[@StandAlonePrimitive = true]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "2", @FloatLiteral = false, @Image = "2", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "2", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 2, @ValueAsLong = 2]
- +- BlockStatement[@Allocation = false]
- | +- Statement[]
- | +- StatementExpression[]
- | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "result"]
- | +- AssignmentOperator[@Compound = false, @Image = "="]
- | +- Expression[@StandAlonePrimitive = false]
- | +- AdditiveExpression[@Image = "-", @Operator = "-"]
- | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "non"]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Name[@Image = "sealed"]
- +- BlockStatement[@Allocation = false]
- +- Statement[]
- +- StatementExpression[]
- +- PrimaryExpression[]
- +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Name[@Image = "System.out.println"]
- +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- +- Arguments[@ArgumentCount = 1, @Size = 1]
- +- ArgumentList[@Size = 1]
- +- Expression[@StandAlonePrimitive = false]
- +- PrimaryExpression[]
- +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- +- Name[@Image = "result"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/PatternMatchingInstanceof.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/PatternMatchingInstanceof.java
deleted file mode 100644
index c541b5c8c0..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/PatternMatchingInstanceof.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- * @see JEP 375: Pattern Matching for instanceof (Second Preview)
- */
-public class PatternMatchingInstanceof {
- private String s = "other string";
-
- public void test() {
- Object obj = "abc";
- //obj = 1;
- if (obj instanceof String s) {
- System.out.println("a) obj == s: " + (obj == s)); // true
- } else {
- System.out.println("b) obj == s: " + (obj == s)); // false
- }
-
- if (!(obj instanceof String s)) {
- System.out.println("c) obj == s: " + (obj == s)); // false
- } else {
- System.out.println("d) obj == s: " + (obj == s)); // true
- }
-
- if (obj instanceof String s && s.length() > 2) {
- System.out.println("e) obj == s: " + (obj == s)); // true
- }
- if (obj instanceof String s || s.length() > 5) {
- System.out.println("f) obj == s: " + (obj == s)); // false
- }
- }
-
- public static void main(String[] args) {
- new PatternMatchingInstanceof().test();
- }
-}
\ No newline at end of file
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/PatternMatchingInstanceof.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/PatternMatchingInstanceof.txt
deleted file mode 100644
index 5e5b481a3e..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/PatternMatchingInstanceof.txt
+++ /dev/null
@@ -1,288 +0,0 @@
-+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
- +- TypeDeclaration[]
- +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "PatternMatchingInstanceof", @Default = false, @Final = false, @Image = "PatternMatchingInstanceof", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "PatternMatchingInstanceof", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
- +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.FIELD]
- | +- FieldDeclaration[@Abstract = false, @AnnotationMember = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @InterfaceMember = false, @Modifiers = 4, @Native = false, @PackagePrivate = false, @Private = true, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @VariableName = "s", @Volatile = false]
- | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | +- VariableDeclarator[@Initializer = true, @Name = "s"]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = true, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
- | +- VariableInitializer[]
- | +- Expression[@StandAlonePrimitive = false]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""other string"", @FloatLiteral = false, @Image = ""other string"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""other string"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "test", @Modifiers = 1, @Name = "test", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
- | +- ResultType[@Void = true, @returnsArray = false]
- | +- MethodDeclarator[@Image = "test", @ParameterCount = 0]
- | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | +- Block[@containsComment = false]
- | +- BlockStatement[@Allocation = false]
- | | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "obj", @Volatile = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
- | | +- VariableDeclarator[@Initializer = true, @Name = "obj"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "obj", @LambdaParameter = false, @LocalVariable = true, @Name = "obj", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "obj"]
- | | +- VariableInitializer[]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""abc"", @FloatLiteral = false, @Image = ""abc"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""abc"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- IfStatement[@Else = true]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- InstanceOfExpression[]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "obj"]
- | | | +- TypePattern[]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
- | | +- Statement[]
- | | | +- Block[@containsComment = true]
- | | | +- BlockStatement[@Allocation = false]
- | | | +- Statement[]
- | | | +- StatementExpression[]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "System.out.println"]
- | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | | +- ArgumentList[@Size = 1]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""a) obj == s: "", @FloatLiteral = false, @Image = ""a) obj == s: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""a) obj == s: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "obj"]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "s"]
- | | +- Statement[]
- | | +- Block[@containsComment = true]
- | | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- StatementExpression[]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "System.out.println"]
- | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | +- ArgumentList[@Size = 1]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""b) obj == s: "", @FloatLiteral = false, @Image = ""b) obj == s: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""b) obj == s: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- EqualityExpression[@Image = "==", @Operator = "=="]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "obj"]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "s"]
- | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- IfStatement[@Else = true]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- UnaryExpressionNotPlusMinus[@Image = "!", @Operator = "!"]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- InstanceOfExpression[]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "obj"]
- | | | +- TypePattern[]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
- | | +- Statement[]
- | | | +- Block[@containsComment = true]
- | | | +- BlockStatement[@Allocation = false]
- | | | +- Statement[]
- | | | +- StatementExpression[]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "System.out.println"]
- | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | | +- ArgumentList[@Size = 1]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""c) obj == s: "", @FloatLiteral = false, @Image = ""c) obj == s: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""c) obj == s: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "obj"]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "s"]
- | | +- Statement[]
- | | +- Block[@containsComment = true]
- | | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- StatementExpression[]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "System.out.println"]
- | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | +- ArgumentList[@Size = 1]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""d) obj == s: "", @FloatLiteral = false, @Image = ""d) obj == s: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""d) obj == s: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- EqualityExpression[@Image = "==", @Operator = "=="]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "obj"]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "s"]
- | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- IfStatement[@Else = false]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- ConditionalAndExpression[]
- | | | +- InstanceOfExpression[]
- | | | | +- PrimaryExpression[]
- | | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | | +- Name[@Image = "obj"]
- | | | | +- TypePattern[]
- | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
- | | | +- RelationalExpression[@Image = ">"]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | | +- Name[@Image = "s.length"]
- | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
- | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "2", @FloatLiteral = false, @Image = "2", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "2", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 2, @ValueAsLong = 2]
- | | +- Statement[]
- | | +- Block[@containsComment = true]
- | | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- StatementExpression[]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "System.out.println"]
- | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | +- ArgumentList[@Size = 1]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""e) obj == s: "", @FloatLiteral = false, @Image = ""e) obj == s: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""e) obj == s: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- EqualityExpression[@Image = "==", @Operator = "=="]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "obj"]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "s"]
- | +- BlockStatement[@Allocation = false]
- | +- Statement[]
- | +- IfStatement[@Else = false]
- | +- Expression[@StandAlonePrimitive = false]
- | | +- ConditionalOrExpression[]
- | | +- InstanceOfExpression[]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "obj"]
- | | | +- TypePattern[]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
- | | +- RelationalExpression[@Image = ">"]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "s.length"]
- | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
- | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "5", @FloatLiteral = false, @Image = "5", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "5", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 5, @ValueAsLong = 5]
- | +- Statement[]
- | +- Block[@containsComment = true]
- | +- BlockStatement[@Allocation = false]
- | +- Statement[]
- | +- StatementExpression[]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "System.out.println"]
- | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | +- ArgumentList[@Size = 1]
- | +- Expression[@StandAlonePrimitive = false]
- | +- AdditiveExpression[@Image = "+", @Operator = "+"]
- | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""f) obj == s: "", @FloatLiteral = false, @Image = ""f) obj == s: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""f) obj == s: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Expression[@StandAlonePrimitive = false]
- | +- EqualityExpression[@Image = "==", @Operator = "=="]
- | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "obj"]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Name[@Image = "s"]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "main", @Modifiers = 17, @Name = "main", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
- +- ResultType[@Void = true, @returnsArray = false]
- +- MethodDeclarator[@Image = "main", @ParameterCount = 1]
- | +- FormalParameters[@ParameterCount = 1, @Size = 1]
- | +- FormalParameter[@Abstract = false, @Array = true, @ArrayDepth = 1, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "String"]
- | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = true, @ArrayDepth = 1, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "args"]
- +- Block[@containsComment = false]
- +- BlockStatement[@Allocation = true]
- +- Statement[]
- +- StatementExpression[]
- +- PrimaryExpression[]
- +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- AllocationExpression[@AnonymousClass = false]
- | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "PatternMatchingInstanceof", @ReferenceToClassSameCompilationUnit = true]
- | +- Arguments[@ArgumentCount = 0, @Size = 0]
- +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "test"]
- +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
- +- Arguments[@ArgumentCount = 0, @Size = 0]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Point.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Point.java
deleted file mode 100644
index bef547a6c6..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Point.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-/**
- * @see JEP 384: Records (Second Preview)
- */
-public record Point(int x, int y) {
-
- public static void main(String[] args) {
- Point p = new Point(1, 2);
- System.out.println("p = " + p);
- }
-}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Point.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Point.txt
deleted file mode 100644
index cdefd5c585..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Point.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
- +- TypeDeclaration[]
- +- RecordDeclaration[@Abstract = false, @BinaryName = "Point", @Default = false, @Final = true, @Image = "Point", @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Point", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- +- RecordComponentList[@Size = 2]
- | +- RecordComponent[@Varargs = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "x", @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "x"]
- | +- RecordComponent[@Varargs = false]
- | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "y", @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "y"]
- +- RecordBody[]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "main", @Modifiers = 17, @Name = "main", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
- +- ResultType[@Void = true, @returnsArray = false]
- +- MethodDeclarator[@Image = "main", @ParameterCount = 1]
- | +- FormalParameters[@ParameterCount = 1, @Size = 1]
- | +- FormalParameter[@Abstract = false, @Array = true, @ArrayDepth = 1, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "String"]
- | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = true, @ArrayDepth = 1, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "args"]
- +- Block[@containsComment = false]
- +- BlockStatement[@Allocation = true]
- | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "p", @Volatile = false]
- | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Point"]
- | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Point", @ReferenceToClassSameCompilationUnit = false]
- | +- VariableDeclarator[@Initializer = true, @Name = "p"]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "p", @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "p"]
- | +- VariableInitializer[]
- | +- Expression[@StandAlonePrimitive = false]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- AllocationExpression[@AnonymousClass = false]
- | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Point", @ReferenceToClassSameCompilationUnit = false]
- | +- Arguments[@ArgumentCount = 2, @Size = 2]
- | +- ArgumentList[@Size = 2]
- | +- Expression[@StandAlonePrimitive = true]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "1", @FloatLiteral = false, @Image = "1", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "1", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 1, @ValueAsLong = 1]
- | +- Expression[@StandAlonePrimitive = true]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "2", @FloatLiteral = false, @Image = "2", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "2", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 2, @ValueAsLong = 2]
- +- BlockStatement[@Allocation = false]
- +- Statement[]
- +- StatementExpression[]
- +- PrimaryExpression[]
- +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Name[@Image = "System.out.println"]
- +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- +- Arguments[@ArgumentCount = 1, @Size = 1]
- +- ArgumentList[@Size = 1]
- +- Expression[@StandAlonePrimitive = false]
- +- AdditiveExpression[@Image = "+", @Operator = "+"]
- +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""p = "", @FloatLiteral = false, @Image = ""p = "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""p = "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- +- PrimaryExpression[]
- +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- +- Name[@Image = "p"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Records.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Records.java
deleted file mode 100644
index 9a756d70c1..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Records.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-import java.io.IOException;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-
-/**
- * @see JEP 384: Records (Second Preview)
- */
-public class Records {
-
- @Target(ElementType.TYPE_USE)
- @interface Nullable { }
-
- @Target({ElementType.CONSTRUCTOR, ElementType.PARAMETER})
- @interface MyAnnotation { }
-
- public record MyComplex(int real, @Deprecated int imaginary) {
- // explicit declaration of a canonical constructor
- @MyAnnotation
- public MyComplex(@MyAnnotation int real, int imaginary) {
- if (real > 100) throw new IllegalArgumentException("too big");
- this.real = real;
- this.imaginary = imaginary;
- }
-
- public record Nested(int a) {}
-
- public static class NestedClass { }
- }
-
-
- public record Range(int lo, int hi) {
- // compact record constructor
- @MyAnnotation
- public Range {
- if (lo > hi) /* referring here to the implicit constructor parameters */
- throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
- }
-
- public void foo() { }
- }
-
- public record VarRec(@Nullable @Deprecated String @Nullable ... x) {}
-
- public record ArrayRec(int x[]) {}
-
- public record EmptyRec() {
- public void foo() { }
- public Type bar() { return null; }
- public static void baz() {
- EmptyRec r = new EmptyRec<>();
- System.out.println(r);
- }
- }
-
- // see https://www.javaspecialists.eu/archive/Issue276.html
- public interface Person {
- String firstName();
- String lastName();
- }
- public record PersonRecord(String firstName, String lastName)
- implements Person, java.io.Serializable {
-
- }
-}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Records.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Records.txt
deleted file mode 100644
index f3940fb5ef..0000000000
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/Records.txt
+++ /dev/null
@@ -1,316 +0,0 @@
-+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
- +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.io.IOException", @ImportedSimpleName = "IOException", @PackageName = "java.io", @Static = false]
- | +- Name[@Image = "java.io.IOException"]
- +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.lang.annotation.Target", @ImportedSimpleName = "Target", @PackageName = "java.lang.annotation", @Static = false]
- | +- Name[@Image = "java.lang.annotation.Target"]
- +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.lang.annotation.ElementType", @ImportedSimpleName = "ElementType", @PackageName = "java.lang.annotation", @Static = false]
- | +- Name[@Image = "java.lang.annotation.ElementType"]
- +- TypeDeclaration[]
- +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "Records", @Default = false, @Final = false, @Image = "Records", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "Records", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
- +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.ANNOTATION]
- | +- Annotation[@AnnotationName = "Target"]
- | | +- SingleMemberAnnotation[@AnnotationName = "Target"]
- | | +- Name[@Image = "Target"]
- | | +- MemberValue[]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "ElementType.TYPE_USE"]
- | +- AnnotationTypeDeclaration[@Abstract = false, @BinaryName = "Records$Nullable", @Default = false, @Final = false, @Image = "Nullable", @Local = false, @Modifiers = 0, @Native = false, @Nested = true, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "Nullable", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.ANNOTATION, @Volatile = false]
- | +- AnnotationTypeBody[]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.ANNOTATION]
- | +- Annotation[@AnnotationName = "Target"]
- | | +- SingleMemberAnnotation[@AnnotationName = "Target"]
- | | +- Name[@Image = "Target"]
- | | +- MemberValue[]
- | | +- MemberValueArrayInitializer[]
- | | +- MemberValue[]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "ElementType.CONSTRUCTOR"]
- | | +- MemberValue[]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "ElementType.PARAMETER"]
- | +- AnnotationTypeDeclaration[@Abstract = false, @BinaryName = "Records$MyAnnotation", @Default = false, @Final = false, @Image = "MyAnnotation", @Local = false, @Modifiers = 0, @Native = false, @Nested = true, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyAnnotation", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.ANNOTATION, @Volatile = false]
- | +- AnnotationTypeBody[]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex", @Default = false, @Final = true, @Image = "MyComplex", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "MyComplex", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | +- RecordComponentList[@Size = 2]
- | | +- RecordComponent[@Varargs = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "real", @LambdaParameter = false, @LocalVariable = false, @Name = "real", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "real"]
- | | +- RecordComponent[@Varargs = false]
- | | +- Annotation[@AnnotationName = "Deprecated"]
- | | | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
- | | | +- Name[@Image = "Deprecated"]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "imaginary", @LambdaParameter = false, @LocalVariable = false, @Name = "imaginary", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "imaginary"]
- | +- RecordBody[]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.CONSTRUCTOR]
- | | +- Annotation[@AnnotationName = "MyAnnotation"]
- | | | +- MarkerAnnotation[@AnnotationName = "MyAnnotation"]
- | | | +- Name[@Image = "MyAnnotation"]
- | | +- ConstructorDeclaration[@Abstract = false, @Arity = 2, @Default = false, @Final = false, @Image = "MyComplex", @Kind = MethodLikeKind.CONSTRUCTOR, @Modifiers = 1, @Native = false, @PackagePrivate = false, @ParameterCount = 2, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @Volatile = false, @containsComment = false]
- | | +- FormalParameters[@ParameterCount = 2, @Size = 2]
- | | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | | | | +- Annotation[@AnnotationName = "MyAnnotation"]
- | | | | | +- MarkerAnnotation[@AnnotationName = "MyAnnotation"]
- | | | | | +- Name[@Image = "MyAnnotation"]
- | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "real", @LambdaParameter = false, @LocalVariable = false, @Name = "real", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "real"]
- | | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "imaginary", @LambdaParameter = false, @LocalVariable = false, @Name = "imaginary", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "imaginary"]
- | | +- BlockStatement[@Allocation = true]
- | | | +- Statement[]
- | | | +- IfStatement[@Else = false]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | | +- RelationalExpression[@Image = ">"]
- | | | | +- PrimaryExpression[]
- | | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | | +- Name[@Image = "real"]
- | | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "100", @FloatLiteral = false, @Image = "100", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "100", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 100, @ValueAsLong = 100]
- | | | +- Statement[]
- | | | +- ThrowStatement[@FirstClassOrInterfaceTypeImage = "IllegalArgumentException"]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- AllocationExpression[@AnonymousClass = false]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "IllegalArgumentException", @ReferenceToClassSameCompilationUnit = false]
- | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | | +- ArgumentList[@Size = 1]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""too big"", @FloatLiteral = false, @Image = ""too big"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""too big"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | +- BlockStatement[@Allocation = false]
- | | | +- Statement[]
- | | | +- StatementExpression[]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = true]
- | | | | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "real"]
- | | | +- AssignmentOperator[@Compound = false, @Image = "="]
- | | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "real"]
- | | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- StatementExpression[]
- | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = true]
- | | | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "imaginary"]
- | | +- AssignmentOperator[@Compound = false, @Image = "="]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "imaginary"]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex$Nested", @Default = false, @Final = true, @Image = "Nested", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Nested", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | | +- RecordComponentList[@Size = 1]
- | | | +- RecordComponent[@Varargs = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "a", @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "a"]
- | | +- RecordBody[]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.CLASS]
- | +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex$NestedClass", @Default = false, @Final = false, @Image = "NestedClass", @Interface = false, @Local = false, @Modifiers = 17, @Native = false, @Nested = true, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "NestedClass", @Static = true, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
- | +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$Range", @Default = false, @Final = true, @Image = "Range", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Range", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | +- RecordComponentList[@Size = 2]
- | | +- RecordComponent[@Varargs = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "lo", @LambdaParameter = false, @LocalVariable = false, @Name = "lo", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "lo"]
- | | +- RecordComponent[@Varargs = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "hi", @LambdaParameter = false, @LocalVariable = false, @Name = "hi", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "hi"]
- | +- RecordBody[]
- | +- CompactConstructorDeclaration[@Abstract = false, @Default = false, @Final = false, @Image = "Range", @Kind = DeclarationKind.RECORD_CONSTRUCTOR, @Modifiers = 1, @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @Volatile = false]
- | | +- Annotation[@AnnotationName = "MyAnnotation"]
- | | | +- MarkerAnnotation[@AnnotationName = "MyAnnotation"]
- | | | +- Name[@Image = "MyAnnotation"]
- | | +- Block[@containsComment = false]
- | | +- BlockStatement[@Allocation = true]
- | | +- Statement[]
- | | +- IfStatement[@Else = false]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- RelationalExpression[@Image = ">"]
- | | | +- PrimaryExpression[]
- | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | | +- Name[@Image = "lo"]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "hi"]
- | | +- Statement[]
- | | +- ThrowStatement[@FirstClassOrInterfaceTypeImage = "IllegalArgumentException"]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- AllocationExpression[@AnonymousClass = false]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "IllegalArgumentException", @ReferenceToClassSameCompilationUnit = false]
- | | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | | +- ArgumentList[@Size = 1]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "String.format"]
- | | +- PrimarySuffix[@ArgumentCount = 3, @Arguments = true, @ArrayDereference = false]
- | | +- Arguments[@ArgumentCount = 3, @Size = 3]
- | | +- ArgumentList[@Size = 3]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""(%d,%d)"", @FloatLiteral = false, @Image = ""(%d,%d)"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""(%d,%d)"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | +- Expression[@StandAlonePrimitive = false]
- | | | +- PrimaryExpression[]
- | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | | +- Name[@Image = "lo"]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "hi"]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "foo", @Modifiers = 1, @Name = "foo", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
- | +- ResultType[@Void = true, @returnsArray = false]
- | +- MethodDeclarator[@Image = "foo", @ParameterCount = 0]
- | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | +- Block[@containsComment = false]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$VarRec", @Default = false, @Final = true, @Image = "VarRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "VarRec", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | +- RecordComponentList[@Size = 1]
- | | +- RecordComponent[@Varargs = true]
- | | +- Annotation[@AnnotationName = "Nullable"]
- | | | +- MarkerAnnotation[@AnnotationName = "Nullable"]
- | | | +- Name[@Image = "Nullable"]
- | | +- Annotation[@AnnotationName = "Deprecated"]
- | | | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
- | | | +- Name[@Image = "Deprecated"]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | | +- Annotation[@AnnotationName = "Nullable"]
- | | | +- MarkerAnnotation[@AnnotationName = "Nullable"]
- | | | +- Name[@Image = "Nullable"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "x", @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "x"]
- | +- RecordBody[]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$ArrayRec", @Default = false, @Final = true, @Image = "ArrayRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "ArrayRec", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | +- RecordComponentList[@Size = 1]
- | | +- RecordComponent[@Varargs = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
- | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
- | | +- VariableDeclaratorId[@Array = true, @ArrayDepth = 1, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "x", @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "x"]
- | +- RecordBody[]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$EmptyRec", @Default = false, @Final = true, @Image = "EmptyRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "EmptyRec", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- | +- TypeParameters[]
- | | +- TypeParameter[@Image = "Type", @Name = "Type", @ParameterName = "Type", @TypeBound = false]
- | +- RecordComponentList[@Size = 0]
- | +- RecordBody[]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "foo", @Modifiers = 1, @Name = "foo", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
- | | +- ResultType[@Void = true, @returnsArray = false]
- | | +- MethodDeclarator[@Image = "foo", @ParameterCount = 0]
- | | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | | +- Block[@containsComment = false]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "bar", @Modifiers = 1, @Name = "bar", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = false, @Volatile = false]
- | | +- ResultType[@Void = false, @returnsArray = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Type"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Type", @ReferenceToClassSameCompilationUnit = false]
- | | +- MethodDeclarator[@Image = "bar", @ParameterCount = 0]
- | | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | | +- Block[@containsComment = false]
- | | +- BlockStatement[@Allocation = false]
- | | +- Statement[]
- | | +- ReturnStatement[]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
- | | +- NullLiteral[]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "baz", @Modifiers = 17, @Name = "baz", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
- | +- ResultType[@Void = true, @returnsArray = false]
- | +- MethodDeclarator[@Image = "baz", @ParameterCount = 0]
- | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | +- Block[@containsComment = false]
- | +- BlockStatement[@Allocation = true]
- | | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "r", @Volatile = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "EmptyRec"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "EmptyRec", @ReferenceToClassSameCompilationUnit = false]
- | | | +- TypeArguments[@Diamond = false]
- | | | +- TypeArgument[@Wildcard = false]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | +- VariableDeclarator[@Initializer = true, @Name = "r"]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "r", @LambdaParameter = false, @LocalVariable = true, @Name = "r", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "r"]
- | | +- VariableInitializer[]
- | | +- Expression[@StandAlonePrimitive = false]
- | | +- PrimaryExpression[]
- | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- AllocationExpression[@AnonymousClass = false]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "EmptyRec", @ReferenceToClassSameCompilationUnit = false]
- | | | +- TypeArguments[@Diamond = true]
- | | +- Arguments[@ArgumentCount = 0, @Size = 0]
- | +- BlockStatement[@Allocation = false]
- | +- Statement[]
- | +- StatementExpression[]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | | +- Name[@Image = "System.out.println"]
- | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
- | +- Arguments[@ArgumentCount = 1, @Size = 1]
- | +- ArgumentList[@Size = 1]
- | +- Expression[@StandAlonePrimitive = false]
- | +- PrimaryExpression[]
- | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
- | +- Name[@Image = "r"]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.INTERFACE]
- | +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "Records$Person", @Default = false, @Final = false, @Image = "Person", @Interface = true, @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "Person", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.INTERFACE, @Volatile = false]
- | +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | | +- MethodDeclaration[@Abstract = true, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = true, @Kind = MethodLikeKind.METHOD, @MethodName = "firstName", @Modifiers = 0, @Name = "firstName", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = false, @Volatile = false]
- | | +- ResultType[@Void = false, @returnsArray = false]
- | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | +- MethodDeclarator[@Image = "firstName", @ParameterCount = 0]
- | | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
- | +- MethodDeclaration[@Abstract = true, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = true, @Kind = MethodLikeKind.METHOD, @MethodName = "lastName", @Modifiers = 0, @Name = "lastName", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = false, @Volatile = false]
- | +- ResultType[@Void = false, @returnsArray = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | +- MethodDeclarator[@Image = "lastName", @ParameterCount = 0]
- | +- FormalParameters[@ParameterCount = 0, @Size = 0]
- +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$PersonRecord", @Default = false, @Final = true, @Image = "PersonRecord", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "PersonRecord", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
- +- RecordComponentList[@Size = 2]
- | +- RecordComponent[@Varargs = false]
- | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "firstName", @LambdaParameter = false, @LocalVariable = false, @Name = "firstName", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "firstName"]
- | +- RecordComponent[@Varargs = false]
- | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
- | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
- | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
- | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "lastName", @LambdaParameter = false, @LocalVariable = false, @Name = "lastName", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "lastName"]
- +- ImplementsList[]
- | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Person", @ReferenceToClassSameCompilationUnit = true]
- | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "java.io.Serializable", @ReferenceToClassSameCompilationUnit = false]
- +- RecordBody[]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt
index 29a891122f..07cc3abbd3 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt
@@ -40,7 +40,7 @@
| | | +- PrimaryExpression[]
| | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | | | +- Name[@Image = "obj"]
- | | | +- TypePattern[]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
| | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
| | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
@@ -150,7 +150,7 @@
| | | +- PrimaryExpression[]
| | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | | | +- Name[@Image = "obj"]
- | | | +- TypePattern[]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
| | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
| | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
@@ -216,7 +216,7 @@
| | | | +- PrimaryExpression[]
| | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | | | | +- Name[@Image = "obj"]
- | | | | +- TypePattern[]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
| | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
| | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
| | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
@@ -265,7 +265,7 @@
| | | | +- PrimaryExpression[]
| | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | | | | +- Name[@Image = "obj"]
- | | | | +- TypePattern[]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
| | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
| | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
| | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
@@ -313,7 +313,7 @@
| | | +- PrimaryExpression[]
| | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | | | +- Name[@Image = "obj"]
- | | | +- TypePattern[]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
| | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
| | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
@@ -378,7 +378,7 @@
| | | +- PrimaryExpression[]
| | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | | | +- Name[@Image = "obj"]
- | | | +- TypePattern[]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
| | | +- Annotation[@AnnotationName = "Deprecated"]
| | | | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
| | | | +- Name[@Image = "Deprecated"]
@@ -446,7 +446,7 @@
| | +- PrimaryExpression[]
| | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | | +- Name[@Image = "obj"]
- | | +- TypePattern[]
+ | | +- TypePattern[@ParenthesisDepth = 0]
| | +- Annotation[@AnnotationName = "Deprecated"]
| | | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
| | | +- Name[@Image = "Deprecated"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.java
new file mode 100644
index 0000000000..2e109cd022
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.java
@@ -0,0 +1,15 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+public class LocalVars {
+
+ public void aMethod() {
+ String sealed = null;
+
+ sealed = this.getClass().getName();
+
+ // error: sealed or non-sealed local classes are not allowed
+ // sealed class LocalSealedClass {}
+ }
+}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt
new file mode 100644
index 0000000000..706743fd71
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt
@@ -0,0 +1,39 @@
++- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
+ +- TypeDeclaration[]
+ +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "LocalVars", @Default = false, @Final = false, @Image = "LocalVars", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "LocalVars", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
+ +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ +- MethodDeclaration[@Abstract = false, @Arity = 0, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "aMethod", @Modifiers = 1, @Name = "aMethod", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
+ +- ResultType[@Void = true, @returnsArray = false]
+ +- MethodDeclarator[@Image = "aMethod", @ParameterCount = 0]
+ | +- FormalParameters[@ParameterCount = 0, @Size = 0]
+ +- Block[@containsComment = true]
+ +- BlockStatement[@Allocation = false]
+ | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "sealed", @Volatile = false]
+ | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | +- VariableDeclarator[@Initializer = true, @Name = "sealed"]
+ | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "sealed", @LambdaParameter = false, @LocalVariable = true, @Name = "sealed", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "sealed"]
+ | +- VariableInitializer[]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- NullLiteral[]
+ +- BlockStatement[@Allocation = false]
+ +- Statement[]
+ +- StatementExpression[]
+ +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Name[@Image = "sealed"]
+ +- AssignmentOperator[@Compound = false, @Image = "="]
+ +- Expression[@StandAlonePrimitive = false]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = true]
+ +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "getClass"]
+ +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "getName"]
+ +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ +- Arguments[@ArgumentCount = 0, @Size = 0]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/ConstantExpr.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/ConstantExpr.java
similarity index 66%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/ConstantExpr.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/ConstantExpr.java
index 800fc3d2d1..22d335c466 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/ConstantExpr.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/ConstantExpr.java
@@ -4,6 +4,6 @@
package com.example.expression;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public final class ConstantExpr implements Expr { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/Expr.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.java
similarity index 70%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/Expr.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.java
index 7218bd477f..5be7b03c0a 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/Expr.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.java
@@ -4,7 +4,7 @@
package com.example.expression;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public sealed interface Expr
permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/Expr.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.txt
similarity index 100%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/Expr.txt
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.txt
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/NegExpr.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/NegExpr.java
similarity index 66%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/NegExpr.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/NegExpr.java
index 35194d1cb9..416645a6a1 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/NegExpr.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/NegExpr.java
@@ -4,6 +4,6 @@
package com.example.expression;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public final class NegExpr implements Expr { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/PlusExpr.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/PlusExpr.java
similarity index 66%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/PlusExpr.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/PlusExpr.java
index ac652798e2..13b2cbb8fb 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/PlusExpr.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/PlusExpr.java
@@ -4,6 +4,6 @@
package com.example.expression;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public final class PlusExpr implements Expr { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/TimesExpr.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/TimesExpr.java
similarity index 66%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/TimesExpr.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/TimesExpr.java
index a5cf1ccc74..cdde6fa214 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/expression/TimesExpr.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/TimesExpr.java
@@ -4,6 +4,6 @@
package com.example.expression;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public final class TimesExpr implements Expr { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Circle.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Circle.java
similarity index 65%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Circle.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Circle.java
index c4baabda9b..feca615807 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Circle.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Circle.java
@@ -4,6 +4,6 @@
package com.example.geometry;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public final class Circle extends Shape { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/FilledRectangle.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/FilledRectangle.java
similarity index 67%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/FilledRectangle.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/FilledRectangle.java
index 92eb290b6b..198ce630d4 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/FilledRectangle.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/FilledRectangle.java
@@ -4,7 +4,7 @@
package com.example.geometry;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public final class FilledRectangle extends Rectangle { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Rectangle.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Rectangle.java
similarity index 71%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Rectangle.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Rectangle.java
index fd66cdd014..470c26d436 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Rectangle.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Rectangle.java
@@ -4,7 +4,7 @@
package com.example.geometry;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public sealed class Rectangle extends Shape
permits TransparentRectangle, FilledRectangle { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Shape.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.java
similarity index 68%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Shape.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.java
index cdec22ef4c..c6687dc3f6 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Shape.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.java
@@ -4,7 +4,7 @@
package com.example.geometry;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public sealed class Shape
permits Circle, Rectangle, Square { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Shape.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt
similarity index 100%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Shape.txt
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Square.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.java
similarity index 66%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Square.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.java
index 75dafdbc92..036d8d00e7 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Square.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.java
@@ -4,7 +4,7 @@
package com.example.geometry;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public non-sealed class Square extends Shape { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Square.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.txt
similarity index 100%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/Square.txt
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.txt
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/TransparentRectangle.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/TransparentRectangle.java
similarity index 67%
rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/TransparentRectangle.java
rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/TransparentRectangle.java
index a5c656157f..420ef3e792 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15p/geometry/TransparentRectangle.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/TransparentRectangle.java
@@ -4,7 +4,7 @@
package com.example.geometry;
/**
- * @see JEP 360: Sealed Classes (Preview)
+ * @see JEP 409: Sealed Classes
*/
public final class TransparentRectangle extends Rectangle { }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.java
new file mode 100644
index 0000000000..4022f189e4
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.java
@@ -0,0 +1,68 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+/**
+ * @see JEP 406: Pattern Matching for switch (Preview)
+ */
+public class DealingWithNull {
+
+
+ static void test(Object o) {
+ switch (o) {
+ case null -> System.out.println("null!");
+ case String s -> System.out.println("String");
+ default -> System.out.println("Something else");
+ }
+ }
+
+
+ static void test2(Object o) {
+ switch (o) {
+ case null -> throw new NullPointerException();
+ case String s -> System.out.println("String: "+s);
+ case Integer i -> System.out.println("Integer");
+ default -> System.out.println("default");
+ }
+ }
+
+
+ static void test3(Object o) {
+ switch(o) {
+ case null: case String s:
+ System.out.println("String, including null");
+ break;
+ default:
+ System.out.println("default case");
+ break;
+ }
+
+ switch(o) {
+ case null, String s -> System.out.println("String, including null");
+ default -> System.out.println("default case");
+ }
+
+ switch(o) {
+ case null: default:
+ System.out.println("The rest (including null)");
+ }
+
+ switch(o) {
+ case null, default ->
+ System.out.println("The rest (including null)");
+ }
+ }
+
+ public static void main(String[] args) {
+ test("test");
+ test2(2);
+ try {
+ test2(null);
+ } catch (NullPointerException e) {
+ System.out.println(e);
+ }
+ test3(3);
+ test3("test");
+ test3(null);
+ }
+}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.txt
new file mode 100644
index 0000000000..fdbf631350
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.txt
@@ -0,0 +1,429 @@
++- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
+ +- TypeDeclaration[]
+ +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "DealingWithNull", @Default = false, @Final = false, @Image = "DealingWithNull", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "DealingWithNull", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
+ +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "test", @Modifiers = 16, @Name = "test", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "test", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- SwitchStatement[@DefaultCase = false, @ExhaustiveEnumSwitch = false]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o"]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | +- NullLiteral[]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""null!"", @FloatLiteral = false, @Image = ""null!"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""null!"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""String"", @FloatLiteral = false, @Image = ""String"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""String"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | +- SwitchLabel[@Default = true]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "System.out.println"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Something else"", @FloatLiteral = false, @Image = ""Something else"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Something else"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "test2", @Modifiers = 16, @Name = "test2", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "test2", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = true]
+ | +- Statement[]
+ | +- SwitchStatement[@DefaultCase = false, @ExhaustiveEnumSwitch = false]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o"]
+ | +- SwitchLabeledThrowStatement[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | +- NullLiteral[]
+ | | +- ThrowStatement[@FirstClassOrInterfaceTypeImage = "NullPointerException"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- AllocationExpression[@AnonymousClass = false]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "NullPointerException", @ReferenceToClassSameCompilationUnit = false]
+ | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
+ | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""String: "", @FloatLiteral = false, @Image = ""String: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""String: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "s"]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Integer"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Integer", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "i"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Integer"", @FloatLiteral = false, @Image = ""Integer"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Integer"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | +- SwitchLabel[@Default = true]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "System.out.println"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""default"", @FloatLiteral = false, @Image = ""default"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""default"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "test3", @Modifiers = 16, @Name = "test3", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "test3", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- SwitchStatement[@DefaultCase = true, @ExhaustiveEnumSwitch = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "o"]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | +- NullLiteral[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | +- BlockStatement[@Allocation = false]
+ | | | +- Statement[]
+ | | | +- StatementExpression[]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""String, including null"", @FloatLiteral = false, @Image = ""String, including null"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""String, including null"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- BlockStatement[@Allocation = false]
+ | | | +- Statement[]
+ | | | +- BreakStatement[]
+ | | +- SwitchLabel[@Default = true]
+ | | +- BlockStatement[@Allocation = false]
+ | | | +- Statement[]
+ | | | +- StatementExpression[]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""default case"", @FloatLiteral = false, @Image = ""default case"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""default case"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- BreakStatement[]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- SwitchStatement[@DefaultCase = false, @ExhaustiveEnumSwitch = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "o"]
+ | | +- SwitchLabeledExpression[]
+ | | | +- SwitchLabel[@Default = false]
+ | | | | +- Expression[@StandAlonePrimitive = false]
+ | | | | | +- PrimaryExpression[]
+ | | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | | | +- NullLiteral[]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""String, including null"", @FloatLiteral = false, @Image = ""String, including null"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""String, including null"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = true]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""default case"", @FloatLiteral = false, @Image = ""default case"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""default case"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- SwitchStatement[@DefaultCase = true, @ExhaustiveEnumSwitch = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "o"]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | +- NullLiteral[]
+ | | +- SwitchLabel[@Default = true]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""The rest (including null)"", @FloatLiteral = false, @Image = ""The rest (including null)"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""The rest (including null)"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- SwitchStatement[@DefaultCase = false, @ExhaustiveEnumSwitch = false]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o"]
+ | +- SwitchLabeledExpression[]
+ | +- SwitchLabel[@Default = true]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- NullLiteral[]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "System.out.println"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""The rest (including null)"", @FloatLiteral = false, @Image = ""The rest (including null)"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""The rest (including null)"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "main", @Modifiers = 17, @Name = "main", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
+ +- ResultType[@Void = true, @returnsArray = false]
+ +- MethodDeclarator[@Image = "main", @ParameterCount = 1]
+ | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | +- FormalParameter[@Abstract = false, @Array = true, @ArrayDepth = 1, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "String"]
+ | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = true, @ArrayDepth = 1, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "args"]
+ +- Block[@containsComment = false]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""test"", @FloatLiteral = false, @Image = ""test"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""test"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test2"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = true]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "2", @FloatLiteral = false, @Image = "2", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "2", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 2, @ValueAsLong = 2]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- TryStatement[@Finally = false, @TryWithResources = false]
+ | +- Block[@containsComment = false]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "test2"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- NullLiteral[]
+ | +- CatchStatement[@ExceptionName = "e", @MulticatchStatement = false]
+ | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "NullPointerException"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "NullPointerException", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = true, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "e", @LambdaParameter = false, @LocalVariable = false, @Name = "e", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "e"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "System.out.println"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Name[@Image = "e"]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test3"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = true]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "3", @FloatLiteral = false, @Image = "3", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "3", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 3, @ValueAsLong = 3]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test3"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""test"", @FloatLiteral = false, @Image = ""test"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""test"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- BlockStatement[@Allocation = false]
+ +- Statement[]
+ +- StatementExpression[]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Name[@Image = "test3"]
+ +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ +- Arguments[@ArgumentCount = 1, @Size = 1]
+ +- ArgumentList[@Size = 1]
+ +- Expression[@StandAlonePrimitive = false]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- NullLiteral[]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.java
new file mode 100644
index 0000000000..eb745cdfb8
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.java
@@ -0,0 +1,29 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+/**
+ * @see JEP 406: Pattern Matching for switch (Preview)
+ */
+public class EnhancedTypeCheckingSwitch {
+
+
+ static void typeTester(Object o) {
+ switch (o) {
+ case null -> System.out.println("null");
+ case String s -> System.out.println("String");
+ case Color c -> System.out.println("Color with " + c.values().length + " values");
+ case Point p -> System.out.println("Record class: " + p.toString());
+ case int[] ia -> System.out.println("Array of ints of length" + ia.length);
+ default -> System.out.println("Something else");
+ }
+ }
+
+ public static void main(String[] args) {
+ Object o = "test";
+ typeTester(o);
+ }
+}
+
+record Point(int i, int j) {}
+enum Color { RED, GREEN, BLUE; }
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt
new file mode 100644
index 0000000000..af55a74853
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt
@@ -0,0 +1,199 @@
++- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
+ +- TypeDeclaration[]
+ | +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "EnhancedTypeCheckingSwitch", @Default = false, @Final = false, @Image = "EnhancedTypeCheckingSwitch", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "EnhancedTypeCheckingSwitch", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
+ | +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
+ | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "typeTester", @Modifiers = 16, @Name = "typeTester", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | | +- ResultType[@Void = true, @returnsArray = false]
+ | | +- MethodDeclarator[@Image = "typeTester", @ParameterCount = 1]
+ | | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | | +- Block[@containsComment = false]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- SwitchStatement[@DefaultCase = false, @ExhaustiveEnumSwitch = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "o"]
+ | | +- SwitchLabeledExpression[]
+ | | | +- SwitchLabel[@Default = false]
+ | | | | +- Expression[@StandAlonePrimitive = false]
+ | | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | | +- NullLiteral[]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""null"", @FloatLiteral = false, @Image = ""null"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""null"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- SwitchLabeledExpression[]
+ | | | +- SwitchLabel[@Default = false]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""String"", @FloatLiteral = false, @Image = ""String"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""String"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- SwitchLabeledExpression[]
+ | | | +- SwitchLabel[@Default = false]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Color"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Color", @ReferenceToClassSameCompilationUnit = true]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "c", @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "c"]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Color with "", @FloatLiteral = false, @Image = ""Color with "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Color with "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "c.values"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | | +- PrimarySuffix[@ArgumentCount = -1, @Arguments = false, @ArrayDereference = false, @Image = "length"]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "" values"", @FloatLiteral = false, @Image = "" values"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = "" values"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- SwitchLabeledExpression[]
+ | | | +- SwitchLabel[@Default = false]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Point"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Point", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "p", @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "p"]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Record class: "", @FloatLiteral = false, @Image = ""Record class: "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Record class: "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "p.toString"]
+ | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | +- SwitchLabeledExpression[]
+ | | | +- SwitchLabel[@Default = false]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "int"]
+ | | | | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
+ | | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "ia", @LambdaParameter = false, @LocalVariable = false, @Name = "ia", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "ia"]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Array of ints of length"", @FloatLiteral = false, @Image = ""Array of ints of length"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Array of ints of length"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "ia.length"]
+ | | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = true]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Something else"", @FloatLiteral = false, @Image = ""Something else"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Something else"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "main", @Modifiers = 17, @Name = "main", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "main", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = true, @ArrayDepth = 1, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "String"]
+ | | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = true, @ArrayDepth = 1, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "args"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "o", @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclarator[@Initializer = true, @Name = "o"]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "o", @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | | +- VariableInitializer[]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""test"", @FloatLiteral = false, @Image = ""test"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""test"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "typeTester"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Name[@Image = "o"]
+ +- TypeDeclaration[]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "Point", @Default = false, @Final = true, @Image = "Point", @Local = false, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "Point", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordComponentList[@Size = 2]
+ | | +- RecordComponent[@Varargs = false]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
+ | | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "i"]
+ | | +- RecordComponent[@Varargs = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
+ | | | +- PrimitiveType[@Array = false, @ArrayDepth = 0, @Boolean = false, @Image = "int"]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "j", @LambdaParameter = false, @LocalVariable = false, @Name = "j", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "j"]
+ | +- RecordBody[]
+ +- TypeDeclaration[]
+ +- EnumDeclaration[@Abstract = false, @BinaryName = "Color", @Default = false, @Final = false, @Image = "Color", @Local = false, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "Color", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.ENUM, @Volatile = false]
+ +- EnumBody[]
+ +- EnumConstant[@AnonymousClass = false, @Image = "RED"]
+ +- EnumConstant[@AnonymousClass = false, @Image = "GREEN"]
+ +- EnumConstant[@AnonymousClass = false, @Image = "BLUE"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.java
new file mode 100644
index 0000000000..fd4c1d58d5
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.java
@@ -0,0 +1,42 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+/**
+ * @see JEP 406: Pattern Matching for switch (Preview)
+ */
+public class GuardedAndParenthesizedPatterns {
+
+
+ static void test(Object o) {
+ switch (o) {
+ case String s && (s.length() == 1) -> System.out.println("single char string");
+ case String s -> System.out.println("string");
+ case (Integer i && i.intValue() == 1) -> System.out.println("integer 1");
+ case (((Long l && l.longValue() == 1L))) -> System.out.println("long 1 with parens");
+ case (((Double d))) -> System.out.println("double with parens");
+ default -> System.out.println("default case");
+ }
+ }
+
+ static void instanceOfPattern(Object o) {
+ if (o instanceof String s && s.length() > 2) {
+ System.out.println("A string containing at least two characters");
+ }
+ if (o != null && (o instanceof String s && s.length() > 3)) {
+ System.out.println("A string containing at least three characters");
+ }
+ if (o instanceof (String s && s.length() > 4)) {
+ System.out.println("A string containing at least four characters");
+ }
+ }
+
+ public static void main(String[] args) {
+ test("a");
+ test("fooo");
+ test(1);
+ test(1L);
+ instanceOfPattern("abcde");
+ test(null);
+ }
+}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.txt
new file mode 100644
index 0000000000..f42b450835
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.txt
@@ -0,0 +1,385 @@
++- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
+ +- TypeDeclaration[]
+ +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "GuardedAndParenthesizedPatterns", @Default = false, @Final = false, @Image = "GuardedAndParenthesizedPatterns", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "GuardedAndParenthesizedPatterns", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
+ +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "test", @Modifiers = 16, @Name = "test", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "test", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- SwitchStatement[@DefaultCase = false, @ExhaustiveEnumSwitch = false]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o"]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- GuardedPattern[@ParenthesisDepth = 0]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "s.length"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "1", @FloatLiteral = false, @Image = "1", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "1", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 1, @ValueAsLong = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""single char string"", @FloatLiteral = false, @Image = ""single char string"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""single char string"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""string"", @FloatLiteral = false, @Image = ""string"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""string"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- GuardedPattern[@ParenthesisDepth = 1]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Integer"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Integer", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "i"]
+ | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "i.intValue"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "1", @FloatLiteral = false, @Image = "1", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "1", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 1, @ValueAsLong = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""integer 1"", @FloatLiteral = false, @Image = ""integer 1"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""integer 1"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- GuardedPattern[@ParenthesisDepth = 3]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Long"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Long", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "l", @LambdaParameter = false, @LocalVariable = false, @Name = "l", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "l"]
+ | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "l.longValue"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "1L", @FloatLiteral = false, @Image = "1L", @IntLiteral = false, @LongLiteral = true, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "1L", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 1, @ValueAsLong = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""long 1 with parens"", @FloatLiteral = false, @Image = ""long 1 with parens"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""long 1 with parens"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 3]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Double"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Double", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "d", @LambdaParameter = false, @LocalVariable = false, @Name = "d", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "d"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""double with parens"", @FloatLiteral = false, @Image = ""double with parens"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""double with parens"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledExpression[]
+ | +- SwitchLabel[@Default = true]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "System.out.println"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""default case"", @FloatLiteral = false, @Image = ""default case"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""default case"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "instanceOfPattern", @Modifiers = 16, @Name = "instanceOfPattern", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "instanceOfPattern", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- IfStatement[@Else = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- ConditionalAndExpression[]
+ | | | +- InstanceOfExpression[]
+ | | | | +- PrimaryExpression[]
+ | | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "o"]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | | +- RelationalExpression[@Image = ">"]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "s.length"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "2", @FloatLiteral = false, @Image = "2", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "2", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 2, @ValueAsLong = 2]
+ | | +- Statement[]
+ | | +- Block[@containsComment = false]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""A string containing at least two characters"", @FloatLiteral = false, @Image = ""A string containing at least two characters"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""A string containing at least two characters"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- IfStatement[@Else = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- ConditionalAndExpression[]
+ | | | +- EqualityExpression[@Image = "!=", @Operator = "!="]
+ | | | | +- PrimaryExpression[]
+ | | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "o"]
+ | | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | | | +- NullLiteral[]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- ConditionalAndExpression[]
+ | | | +- InstanceOfExpression[]
+ | | | | +- PrimaryExpression[]
+ | | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "o"]
+ | | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | | +- RelationalExpression[@Image = ">"]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "s.length"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "3", @FloatLiteral = false, @Image = "3", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "3", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 3, @ValueAsLong = 3]
+ | | +- Statement[]
+ | | +- Block[@containsComment = false]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""A string containing at least three characters"", @FloatLiteral = false, @Image = ""A string containing at least three characters"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""A string containing at least three characters"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- IfStatement[@Else = false]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- InstanceOfExpression[]
+ | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "o"]
+ | | +- GuardedPattern[@ParenthesisDepth = 1]
+ | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | +- RelationalExpression[@Image = ">"]
+ | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "s.length"]
+ | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "4", @FloatLiteral = false, @Image = "4", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "4", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 4, @ValueAsLong = 4]
+ | +- Statement[]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "System.out.println"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""A string containing at least four characters"", @FloatLiteral = false, @Image = ""A string containing at least four characters"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""A string containing at least four characters"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "main", @Modifiers = 17, @Name = "main", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
+ +- ResultType[@Void = true, @returnsArray = false]
+ +- MethodDeclarator[@Image = "main", @ParameterCount = 1]
+ | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | +- FormalParameter[@Abstract = false, @Array = true, @ArrayDepth = 1, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "String"]
+ | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = true, @ArrayDepth = 1, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "args"]
+ +- Block[@containsComment = false]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""a"", @FloatLiteral = false, @Image = ""a"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = true, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""a"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""fooo"", @FloatLiteral = false, @Image = ""fooo"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""fooo"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = true]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "1", @FloatLiteral = false, @Image = "1", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "1", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 1, @ValueAsLong = 1]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = true]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "1L", @FloatLiteral = false, @Image = "1L", @IntLiteral = false, @LongLiteral = true, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "1L", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 1, @ValueAsLong = 1]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "instanceOfPattern"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""abcde"", @FloatLiteral = false, @Image = ""abcde"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""abcde"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- BlockStatement[@Allocation = false]
+ +- Statement[]
+ +- StatementExpression[]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Name[@Image = "test"]
+ +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ +- Arguments[@ArgumentCount = 1, @Size = 1]
+ +- ArgumentList[@Size = 1]
+ +- Expression[@StandAlonePrimitive = false]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = null, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = null, @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- NullLiteral[]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.java
new file mode 100644
index 0000000000..ce4427b372
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.java
@@ -0,0 +1,22 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+/**
+ * @see JEP 406: Pattern Matching for switch (Preview)
+ */
+public class PatternsInSwitchLabels {
+
+
+ public static void main(String[] args) {
+ Object o = 123L;
+ String formatted = switch (o) {
+ case Integer i -> String.format("int %d", i);
+ case Long l -> String.format("long %d", l);
+ case Double d -> String.format("double %f", d);
+ case String s -> String.format("String %s", s);
+ default -> o.toString();
+ };
+ System.out.println(formatted);
+ }
+}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.txt
new file mode 100644
index 0000000000..c13492cb44
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.txt
@@ -0,0 +1,150 @@
++- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
+ +- TypeDeclaration[]
+ +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "PatternsInSwitchLabels", @Default = false, @Final = false, @Image = "PatternsInSwitchLabels", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "PatternsInSwitchLabels", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
+ +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "main", @Modifiers = 17, @Name = "main", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
+ +- ResultType[@Void = true, @returnsArray = false]
+ +- MethodDeclarator[@Image = "main", @ParameterCount = 1]
+ | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | +- FormalParameter[@Abstract = false, @Array = true, @ArrayDepth = 1, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "String"]
+ | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = true, @ArrayDepth = 1, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "args"]
+ +- Block[@containsComment = false]
+ +- BlockStatement[@Allocation = false]
+ | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "o", @Volatile = false]
+ | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | +- VariableDeclarator[@Initializer = true, @Name = "o"]
+ | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "o", @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- VariableInitializer[]
+ | +- Expression[@StandAlonePrimitive = true]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "123L", @FloatLiteral = false, @Image = "123L", @IntLiteral = false, @LongLiteral = true, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "123L", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 123, @ValueAsLong = 123]
+ +- BlockStatement[@Allocation = false]
+ | +- LocalVariableDeclaration[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @VariableName = "formatted", @Volatile = false]
+ | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | +- VariableDeclarator[@Initializer = true, @Name = "formatted"]
+ | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "formatted", @LambdaParameter = false, @LocalVariable = true, @Name = "formatted", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "formatted"]
+ | +- VariableInitializer[]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- SwitchExpression[]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o"]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Integer"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Integer", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "i"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "String.format"]
+ | | +- PrimarySuffix[@ArgumentCount = 2, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 2, @Size = 2]
+ | | +- ArgumentList[@Size = 2]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""int %d"", @FloatLiteral = false, @Image = ""int %d"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""int %d"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "i"]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Long"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Long", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "l", @LambdaParameter = false, @LocalVariable = false, @Name = "l", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "l"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "String.format"]
+ | | +- PrimarySuffix[@ArgumentCount = 2, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 2, @Size = 2]
+ | | +- ArgumentList[@Size = 2]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""long %d"", @FloatLiteral = false, @Image = ""long %d"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""long %d"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "l"]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Double"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Double", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "d", @LambdaParameter = false, @LocalVariable = false, @Name = "d", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "d"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "String.format"]
+ | | +- PrimarySuffix[@ArgumentCount = 2, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 2, @Size = 2]
+ | | +- ArgumentList[@Size = 2]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""double %f"", @FloatLiteral = false, @Image = ""double %f"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""double %f"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "d"]
+ | +- SwitchLabeledExpression[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "s"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "String.format"]
+ | | +- PrimarySuffix[@ArgumentCount = 2, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 2, @Size = 2]
+ | | +- ArgumentList[@Size = 2]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""String %s"", @FloatLiteral = false, @Image = ""String %s"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""String %s"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "s"]
+ | +- SwitchLabeledExpression[]
+ | +- SwitchLabel[@Default = true]
+ | +- Expression[@StandAlonePrimitive = false]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o.toString"]
+ | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ +- BlockStatement[@Allocation = false]
+ +- Statement[]
+ +- StatementExpression[]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Name[@Image = "System.out.println"]
+ +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ +- Arguments[@ArgumentCount = 1, @Size = 1]
+ +- ArgumentList[@Size = 1]
+ +- Expression[@StandAlonePrimitive = false]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ +- Name[@Image = "formatted"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.java
new file mode 100644
index 0000000000..f0caa28558
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.java
@@ -0,0 +1,48 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+/**
+ * @see JEP 406: Pattern Matching for switch (Preview)
+ */
+public class ScopeOfPatternVariableDeclarations {
+
+
+ static void test(Object o) {
+ switch (o) {
+ case Character c -> {
+ if (c.charValue() == 7) {
+ System.out.println("Ding!");
+ }
+ System.out.println("Character");
+ }
+ case Integer i ->
+ throw new IllegalStateException("Invalid Integer argument of value " + i.intValue());
+ default -> {
+ break;
+ }
+ }
+ }
+
+
+ static void test2(Object o) {
+ switch (o) {
+ case Character c:
+ if (c.charValue() == 7) {
+ System.out.print("Ding ");
+ }
+ if (c.charValue() == 9) {
+ System.out.print("Tab ");
+ }
+ System.out.println("character");
+ default:
+ System.out.println();
+ }
+ }
+
+
+ public static void main(String[] args) {
+ test('A');
+ test2('\t');
+ }
+}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.txt
new file mode 100644
index 0000000000..2d8dd4158e
--- /dev/null
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.txt
@@ -0,0 +1,241 @@
++- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
+ +- TypeDeclaration[]
+ +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "ScopeOfPatternVariableDeclarations", @Default = false, @Final = false, @Image = "ScopeOfPatternVariableDeclarations", @Interface = false, @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "ScopeOfPatternVariableDeclarations", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
+ +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "test", @Modifiers = 16, @Name = "test", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "test", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = true]
+ | +- Statement[]
+ | +- SwitchStatement[@DefaultCase = false, @ExhaustiveEnumSwitch = false]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o"]
+ | +- SwitchLabeledBlock[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Character"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Character", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "c", @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "c"]
+ | | +- Block[@containsComment = false]
+ | | +- BlockStatement[@Allocation = false]
+ | | | +- Statement[]
+ | | | +- IfStatement[@Else = false]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
+ | | | | +- PrimaryExpression[]
+ | | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | | +- Name[@Image = "c.charValue"]
+ | | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "7", @FloatLiteral = false, @Image = "7", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "7", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 7, @ValueAsLong = 7]
+ | | | +- Statement[]
+ | | | +- Block[@containsComment = false]
+ | | | +- BlockStatement[@Allocation = false]
+ | | | +- Statement[]
+ | | | +- StatementExpression[]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | +- Name[@Image = "System.out.println"]
+ | | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | | +- ArgumentList[@Size = 1]
+ | | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Ding!"", @FloatLiteral = false, @Image = ""Ding!"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Ding!"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Character"", @FloatLiteral = false, @Image = ""Character"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Character"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabeledThrowStatement[]
+ | | +- SwitchLabel[@Default = false]
+ | | | +- TypePattern[@ParenthesisDepth = 0]
+ | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Integer"]
+ | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Integer", @ReferenceToClassSameCompilationUnit = false]
+ | | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "i"]
+ | | +- ThrowStatement[@FirstClassOrInterfaceTypeImage = "IllegalStateException"]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- AllocationExpression[@AnonymousClass = false]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "IllegalStateException", @ReferenceToClassSameCompilationUnit = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- AdditiveExpression[@Image = "+", @Operator = "+"]
+ | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Invalid Integer argument of value "", @FloatLiteral = false, @Image = ""Invalid Integer argument of value "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Invalid Integer argument of value "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "i.intValue"]
+ | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | +- SwitchLabeledBlock[]
+ | +- SwitchLabel[@Default = true]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- BreakStatement[]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ | +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "test2", @Modifiers = 16, @Name = "test2", @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = false, @Transient = false, @Void = true, @Volatile = false]
+ | +- ResultType[@Void = true, @returnsArray = false]
+ | +- MethodDeclarator[@Image = "test2", @ParameterCount = 1]
+ | | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | | +- FormalParameter[@Abstract = false, @Array = false, @ArrayDepth = 0, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Object"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Object", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "o"]
+ | +- Block[@containsComment = false]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- SwitchStatement[@DefaultCase = true, @ExhaustiveEnumSwitch = false]
+ | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "o"]
+ | +- SwitchLabel[@Default = false]
+ | | +- TypePattern[@ParenthesisDepth = 0]
+ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Character"]
+ | | | +- ReferenceType[@Array = false, @ArrayDepth = 0]
+ | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "Character", @ReferenceToClassSameCompilationUnit = false]
+ | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = false, @Image = "c", @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "c"]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- IfStatement[@Else = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "c.charValue"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "7", @FloatLiteral = false, @Image = "7", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "7", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 7, @ValueAsLong = 7]
+ | | +- Statement[]
+ | | +- Block[@containsComment = false]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.print"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Ding "", @FloatLiteral = false, @Image = ""Ding "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Ding "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- IfStatement[@Else = false]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | | +- EqualityExpression[@Image = "==", @Operator = "=="]
+ | | | +- PrimaryExpression[]
+ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | | | +- Name[@Image = "c.charValue"]
+ | | | | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | | | | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ | | | +- PrimaryExpression[]
+ | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = "9", @FloatLiteral = false, @Image = "9", @IntLiteral = true, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "9", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 9, @ValueAsLong = 9]
+ | | +- Statement[]
+ | | +- Block[@containsComment = false]
+ | | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.print"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""Tab "", @FloatLiteral = false, @Image = ""Tab "", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""Tab "", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- BlockStatement[@Allocation = false]
+ | | +- Statement[]
+ | | +- StatementExpression[]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | | +- Name[@Image = "System.out.println"]
+ | | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | | +- ArgumentList[@Size = 1]
+ | | +- Expression[@StandAlonePrimitive = false]
+ | | +- PrimaryExpression[]
+ | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Literal[@CharLiteral = false, @DoubleLiteral = false, @EscapedStringLiteral = ""character"", @FloatLiteral = false, @Image = ""character"", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = true, @TextBlock = false, @TextBlockContent = ""character"", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ | +- SwitchLabel[@Default = true]
+ | +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "System.out.println"]
+ | +- PrimarySuffix[@ArgumentCount = 0, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 0, @Size = 0]
+ +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.METHOD]
+ +- MethodDeclaration[@Abstract = false, @Arity = 1, @Default = false, @Final = false, @InterfaceMember = false, @Kind = MethodLikeKind.METHOD, @MethodName = "main", @Modifiers = 17, @Name = "main", @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyPublic = true, @Transient = false, @Void = true, @Volatile = false]
+ +- ResultType[@Void = true, @returnsArray = false]
+ +- MethodDeclarator[@Image = "main", @ParameterCount = 1]
+ | +- FormalParameters[@ParameterCount = 1, @Size = 1]
+ | +- FormalParameter[@Abstract = false, @Array = true, @ArrayDepth = 1, @Default = false, @ExplicitReceiverParameter = false, @Final = false, @Modifiers = 0, @Native = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeInferred = false, @Varargs = false, @Volatile = false]
+ | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "String"]
+ | | +- ReferenceType[@Array = true, @ArrayDepth = 1]
+ | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = true, @ArrayDepth = 1, @Image = "String", @ReferenceToClassSameCompilationUnit = false]
+ | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "args"]
+ +- Block[@containsComment = false]
+ +- BlockStatement[@Allocation = false]
+ | +- Statement[]
+ | +- StatementExpression[]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | | +- Name[@Image = "test"]
+ | +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ | +- Arguments[@ArgumentCount = 1, @Size = 1]
+ | +- ArgumentList[@Size = 1]
+ | +- Expression[@StandAlonePrimitive = true]
+ | +- PrimaryExpression[]
+ | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Literal[@CharLiteral = true, @DoubleLiteral = false, @EscapedStringLiteral = "'A'", @FloatLiteral = false, @Image = "'A'", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "'A'", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
+ +- BlockStatement[@Allocation = false]
+ +- Statement[]
+ +- StatementExpression[]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ | +- Name[@Image = "test2"]
+ +- PrimarySuffix[@ArgumentCount = 1, @Arguments = true, @ArrayDereference = false]
+ +- Arguments[@ArgumentCount = 1, @Size = 1]
+ +- ArgumentList[@Size = 1]
+ +- Expression[@StandAlonePrimitive = true]
+ +- PrimaryExpression[]
+ +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
+ +- Literal[@CharLiteral = true, @DoubleLiteral = false, @EscapedStringLiteral = "' '", @FloatLiteral = false, @Image = "' '", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "' '", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals.java
index 497591db2c..8e3780ff45 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals.java
@@ -2,7 +2,7 @@ public class Foo {
public void bar() {
System.out.println("hello");
System.out.println("hello");
- int i = 5
+ int i = 5;
System.out.print("hello");
}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.java
index b581a387f0..6a1bb6b24f 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.java
@@ -10,4 +10,4 @@ package foo.bar.baz;
public class Foo {}
@SuppressWarnings({"ugh","CPD-END"})
-
+class Other {}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt
index 963dacb5fc..2cbbb4a2f7 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt
@@ -10,4 +10,9 @@ L12
["CPD-END"] 26 34
[}] 35 35
[)] 36 36
+L13
+ [class] 1 5
+ [Other] 7 11
+ [{] 13 13
+ [}] 14 14
EOF
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt
index 49ab402048..c3fde40d3d 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt
@@ -1,2 +1,7 @@
[Image] or [Truncated image[ Bcol Ecol
+L13
+ [class] 1 5
+ [Other] 7 11
+ [{] 13 13
+ [}] 14 14
EOF
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.java
index 1e76e996b9..8dfe5729a5 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.java
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.java
@@ -1 +1,3 @@
+class tabWidth {
int i = 0;
+}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt
index 7f90d9b58a..ef2066b116 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt
@@ -1,7 +1,13 @@
[Image] or [Truncated image[ Bcol Ecol
L1
+ [class] 1 5
+ [tabWidth] 7 14
+ [{] 16 16
+L2
[int] 2 4
[i] 6 6
[=] 8 8
[0] 10 10
+L3
+ [}] 1 1
EOF
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml
index a03e00f19e..7b12a278ea 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml
@@ -377,7 +377,7 @@ public class CovariantReturnType extends AbstractClass {
- Avoid false positives when in ambiguous situation
+ Avoid false positives when in ambiguous situation - AmbiguousOverload
0
{
- Avoid false positives when in ambiguous situation
+ Avoid false positives when in ambiguous situation - HierarchyWithSeveralBridges
0
theList) {
}
}
]]>
- java 15-preview
diff --git a/pom.xml b/pom.xml
index 90ed08b0ff..80ab08f514 100644
--- a/pom.xml
+++ b/pom.xml
@@ -669,7 +669,7 @@
org.ow2.asm
asm
- 9.1
+ 9.2
net.sourceforge.pmd