From 32a76bd602fcdb947bbca3465403c6ee7430ec89 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 7 Jul 2022 15:24:49 +0200 Subject: [PATCH] [java] Remove language version 17-preview --- docs/pages/pmd/languages/java.md | 1 - docs/pages/pmd/userdocs/tools/ant.md | 1 - .../resources/rulesets/internal/all-java.xml | 3 +- pmd-java/etc/grammar/Java.jjt | 17 +- .../pmd/lang/java/JavaLanguageModule.java | 1 - .../lang/java/ast/AllJavaAstTreeDumpTest.java | 4 +- .../java/ast/Java17PreviewTreeDumpTest.java | 92 ---- .../pmd/lang/java/ast/Java17TreeDumpTest.java | 4 - .../java/ast/Java18PreviewTreeDumpTest.java | 6 +- .../java/ast/Java19PreviewTreeDumpTest.java | 6 +- .../pmd/lang/java/ast/KotlinTestingDsl.kt | 2 +- .../java17p/DealingWithNull.java | 68 --- .../java17p/DealingWithNull.txt | 429 ------------------ .../java17p/EnhancedTypeCheckingSwitch.java | 29 -- .../java17p/EnhancedTypeCheckingSwitch.txt | 199 -------- .../GuardedAndParenthesizedPatterns.java | 42 -- .../GuardedAndParenthesizedPatterns.txt | 385 ---------------- .../java17p/PatternsInSwitchLabels.java | 22 - .../java17p/PatternsInSwitchLabels.txt | 150 ------ .../ScopeOfPatternVariableDeclarations.java | 48 -- .../ScopeOfPatternVariableDeclarations.txt | 241 ---------- 21 files changed, 19 insertions(+), 1731 deletions(-) delete mode 100644 pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17PreviewTreeDumpTest.java delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.java delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.txt delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.java delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.java delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.txt delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.java delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.txt delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.java delete mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.txt diff --git a/docs/pages/pmd/languages/java.md b/docs/pages/pmd/languages/java.md index b3737a878c..29f24c02a7 100644 --- a/docs/pages/pmd/languages/java.md +++ b/docs/pages/pmd/languages/java.md @@ -13,7 +13,6 @@ Usually the latest non-preview Java Version is the default version. | 19 (default) | | 6.48.0 | | 18-preview | | 6.44.0 | | 18 | | 6.44.0 | -| 17-preview | | 6.37.0 | | 17 | | 6.37.0 | | 16 | | 6.32.0 | | 15 | | 6.27.0 | diff --git a/docs/pages/pmd/userdocs/tools/ant.md b/docs/pages/pmd/userdocs/tools/ant.md index a56acfdff6..9212ac552c 100644 --- a/docs/pages/pmd/userdocs/tools/ant.md +++ b/docs/pages/pmd/userdocs/tools/ant.md @@ -236,7 +236,6 @@ nested element. Possible values are: - diff --git a/pmd-core/src/main/resources/rulesets/internal/all-java.xml b/pmd-core/src/main/resources/rulesets/internal/all-java.xml index 520734b34f..796a9964d8 100644 --- a/pmd-core/src/main/resources/rulesets/internal/all-java.xml +++ b/pmd-core/src/main/resources/rulesets/internal/all-java.xml @@ -27,9 +27,8 @@ .*/net/sourceforge/pmd/lang/java/ast/InfiniteLoopInLookahead.java - .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.java .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java18p/GuardedAndParenthesizedPatterns.java .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java18p/RefiningPatternsInSwitch.java diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index ac82ecae8b..7ade381d06 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -3,6 +3,7 @@ * Note: GuardedPattern is deprecated and only valid for 17-preview and 18-preview * New AST node: Guard - used within switch case labels for refining a pattern * Support "JEP 405: Record Patterns (Preview)" for Java 19 Preview + * Remove support for Java 17 preview language features * Andreas Dangel 07/2022 *==================================================================== * Support "JEP 420: Pattern Matching for switch (Second Preview)" for Java 18 Preview @@ -540,36 +541,36 @@ public class JavaParser { } private boolean isJEP406Supported() { - return (jdkVersion == 17 || jdkVersion == 18 || jdkVersion == 19) && preview; + return (jdkVersion == 18 || jdkVersion == 19) && preview; } private void checkForPatternMatchingInSwitch() { if (!isJEP406Supported()) { - throwParseException("Pattern Matching in Switch is only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview."); + throwParseException("Pattern Matching in Switch is only supported with JDK 18 Preview or JDK 19 Preview."); } } private void checkForNullCaseLabel() { if (!isJEP406Supported()) { - throwParseException("Null case labels in switch are only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview."); + throwParseException("Null case labels in switch are only supported with JDK 18 Preview or JDK 19 Preview."); } } private void checkForDefaultCaseLabel() { if (!isJEP406Supported()) { - throwParseException("Default case labels in switch are only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview."); + throwParseException("Default case labels in switch are only supported with JDK 18 Preview or JDK 19 Preview."); } } private void checkForGuardedPatterns() { - if (!((jdkVersion == 17 || jdkVersion == 18) && preview)) { - throwParseException("Guarded patterns are only supported with JDK 17 Preview or JDK 18 Preview."); + if (!((jdkVersion == 18) && preview)) { + throwParseException("Guarded patterns are only supported with JDK 18 Preview."); } } private void checkForParenthesizedInstanceOfPattern() { - if (!((jdkVersion == 17 || jdkVersion == 18) && preview)) { - throwParseException("Parenthesized InstanceOf patterns are only supported with JDK 17 Preview or JDK 18 Preview."); + if (!((jdkVersion == 18) && preview)) { + throwParseException("Parenthesized InstanceOf patterns are only supported with JDK 18 Preview."); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaLanguageModule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaLanguageModule.java index 5cf3898e6f..5a75b18018 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaLanguageModule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaLanguageModule.java @@ -31,7 +31,6 @@ public class JavaLanguageModule extends BaseLanguageModule { addVersion("15", new JavaLanguageHandler(15)); addVersion("16", new JavaLanguageHandler(16)); addVersion("17", new JavaLanguageHandler(17)); - addVersion("17-preview", new JavaLanguageHandler(17, true)); addVersion("18", new JavaLanguageHandler(18)); addVersion("18-preview", new JavaLanguageHandler(18, true)); addDefaultVersion("19", new JavaLanguageHandler(19)); // 19 is the default diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/AllJavaAstTreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/AllJavaAstTreeDumpTest.java index 9ba724d357..025a81bd45 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/AllJavaAstTreeDumpTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/AllJavaAstTreeDumpTest.java @@ -13,9 +13,9 @@ import org.junit.runners.Suite.SuiteClasses; ParserCornersTest.class, Java15TreeDumpTest.class, Java16TreeDumpTest.class, - Java17PreviewTreeDumpTest.class, Java17TreeDumpTest.class, - Java18PreviewTreeDumpTest.class + Java18PreviewTreeDumpTest.class, + Java19PreviewTreeDumpTest.class }) public class AllJavaAstTreeDumpTest { 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 deleted file mode 100644 index 746f8c17ed..0000000000 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java17PreviewTreeDumpTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 or JDK 18 Preview or JDK 19 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 or JDK 18 Preview or JDK 19 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 or JDK 18 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 index 2a03fdedf1..4b46800d9c 100644 --- 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 @@ -18,7 +18,6 @@ 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() { @@ -45,13 +44,11 @@ public class Java17TreeDumpTest extends BaseTreeDumpTest { @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 @@ -69,7 +66,6 @@ public class Java17TreeDumpTest extends BaseTreeDumpTest { @Test public void sealedInterface() { doTest("expression/Expr"); - java17p.parseResource("expression/Expr.java"); // make sure we can parse it with preview as well } @Test diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java18PreviewTreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java18PreviewTreeDumpTest.java index 279f249238..26647b33f9 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java18PreviewTreeDumpTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java18PreviewTreeDumpTest.java @@ -38,7 +38,7 @@ public class Java18PreviewTreeDumpTest extends BaseTreeDumpTest { } }); Assert.assertTrue("Unexpected message: " + thrown.getMessage(), - thrown.getMessage().contains("Null case labels in switch are only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview.")); + thrown.getMessage().contains("Null case labels in switch are only supported with JDK 18 Preview or JDK 19 Preview.")); } @Test @@ -65,7 +65,7 @@ public class Java18PreviewTreeDumpTest extends BaseTreeDumpTest { } }); Assert.assertTrue("Unexpected message: " + thrown.getMessage(), - thrown.getMessage().contains("Guarded patterns are only supported with JDK 17 Preview or JDK 18 Preview.")); + thrown.getMessage().contains("Guarded patterns are only supported with JDK 18 Preview.")); } @Test @@ -82,7 +82,7 @@ public class Java18PreviewTreeDumpTest extends BaseTreeDumpTest { } }); Assert.assertTrue("Unexpected message: " + thrown.getMessage(), - thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview.")); + thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 18 Preview or JDK 19 Preview.")); } @Test diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java19PreviewTreeDumpTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java19PreviewTreeDumpTest.java index 2f43b47ac1..1e8c80cd5d 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java19PreviewTreeDumpTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java19PreviewTreeDumpTest.java @@ -40,7 +40,7 @@ public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest { } }); assertTrue("Unexpected message: " + thrown.getMessage(), - thrown.getMessage().contains("Null case labels in switch are only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview.")); + thrown.getMessage().contains("Null case labels in switch are only supported with JDK 18 Preview or JDK 19 Preview.")); } @Test @@ -67,7 +67,7 @@ public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest { } }); assertTrue("Unexpected message: " + thrown.getMessage(), - thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview.")); + thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 18 Preview or JDK 19 Preview.")); } @Test @@ -84,7 +84,7 @@ public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest { } }); assertTrue("Unexpected message: " + thrown.getMessage(), - thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 17 Preview or JDK 18 Preview or JDK 19 Preview.")); + thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 18 Preview or JDK 19 Preview.")); } @Test 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 87a89ca30c..f759b45db9 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 @@ -23,7 +23,7 @@ enum class JavaVersion : Comparable { J14, J15, J16, - J17, J17__PREVIEW, + J17, J18, J18__PREVIEW, J19, J19__PREVIEW; 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 deleted file mode 100644 index 4022f189e4..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 deleted file mode 100644 index 2e81b3be14..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/DealingWithNull.txt +++ /dev/null @@ -1,429 +0,0 @@ -+- 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 = true, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = 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 = true, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = 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, @FallthroughSwitch = true] - | | +- 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 = true, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = 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, @FallthroughSwitch = true] - | | +- 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 = true, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = 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 deleted file mode 100644 index eb745cdfb8..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 deleted file mode 100644 index 15082ceb4e..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt +++ /dev/null @@ -1,199 +0,0 @@ -+- 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 = true, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = 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, @SyntacticallyFinal = 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 deleted file mode 100644 index fd4c1d58d5..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 deleted file mode 100644 index 833fd9b0e5..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/GuardedAndParenthesizedPatterns.txt +++ /dev/null @@ -1,385 +0,0 @@ -+- 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 = true, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = 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 deleted file mode 100644 index ce4427b372..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 deleted file mode 100644 index 71557a780e..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/PatternsInSwitchLabels.txt +++ /dev/null @@ -1,150 +0,0 @@ -+- 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 deleted file mode 100644 index f0caa28558..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index e2d6b63390..0000000000 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/ScopeOfPatternVariableDeclarations.txt +++ /dev/null @@ -1,241 +0,0 @@ -+- 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 = true, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = 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, @FallthroughSwitch = true] - | +- 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 = "\'\\t\'", @FloatLiteral = false, @Image = "\'\\t\'", @IntLiteral = false, @LongLiteral = false, @SingleCharacterStringLiteral = false, @StringLiteral = false, @TextBlock = false, @TextBlockContent = "\'\\t\'", @ValueAsDouble = NaN, @ValueAsFloat = NaN, @ValueAsInt = 0, @ValueAsLong = 0]