diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt
index 8461a07438..1d455f009b 100644
--- a/pmd-java/etc/grammar/Java.jjt
+++ b/pmd-java/etc/grammar/Java.jjt
@@ -1,4 +1,8 @@
/**
+ * Promote "JEP 441: Pattern Matching for switch" as permanent language feature for Java 21.
+ * Renamed SwitchGuard to Guard.
+ * Andreas Dangel 08/2023
+ *====================================================================
* Support "JEP 433: Pattern Matching for switch (Fourth Preview)" for Java 20 Preview
* SwitchLabel simplified
* Support "JEP 432: Record Patterns (Second Preview)" for Java 20 Preview
@@ -1721,6 +1725,8 @@ void Pattern() #void:
| TypePattern()
}
+// ParenthesizedPatterns are removed with Java 21 (JEP 441), but needed for now to support Java 20 Preview
+// TODO: Remove ParenthesizedPattern once java 20-preview is removed
void ParenthesizedPattern() #void:
{}
{
@@ -2453,22 +2459,14 @@ void SwitchLabel() :
void CaseLabelElement(ASTSwitchLabel label) #void:
{}
{
- "default" {label.setDefault();} // only valid in java-19-preview
- |
- "null" #NullLiteral
- [
- // this lookahead is only required to allow parsing java-19-preview code
- // since java-20-preview, combining null is only allowed with default
- LOOKAHEAD(2)
- "," "default" {label.setDefault();}
- ]
+ "null" #NullLiteral [ "," "default" {label.setDefault();} ]
|
LOOKAHEAD(Pattern()) Pattern() [ LOOKAHEAD({isKeyword("when")}) Guard() ]
|
ConditionalExpression()
}
-void Guard() #SwitchGuard:
+void Guard() :
{}
{
softKeyword("when")
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTSwitchGuard.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTGuard.java
similarity index 53%
rename from pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTSwitchGuard.java
rename to pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTGuard.java
index 995a7ea3e9..848fff414e 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTSwitchGuard.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTGuard.java
@@ -4,25 +4,22 @@
package net.sourceforge.pmd.lang.java.ast;
-import net.sourceforge.pmd.annotation.Experimental;
-
/**
* A guard for refining a switch case in {@link ASTSwitchLabel}s.
- * This is a Java 19 Preview and Java 20 Preview language feature.
+ * This is a Java 21 language feature.
*
*
*
- * SwitchLabel := "case" {@linkplain ASTPattern Pattern} SwitchGuard?
- * SwitchGuard ::= "when" {@linkplain ASTExpression Expression}
+ * SwitchLabel := "case" {@linkplain ASTPattern Pattern} Guard?
+ * Guard ::= "when" {@linkplain ASTExpression Expression}
*
*
*
- * @see JEP 433: Pattern Matching for switch (Fourth Preview)
+ * @see JEP 441: Pattern Matching for switch
*/
-@Experimental
-public final class ASTSwitchGuard extends AbstractJavaNode {
+public final class ASTGuard extends AbstractJavaNode {
- ASTSwitchGuard(int id) {
+ ASTGuard(int id) {
super(id);
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTSwitchLabel.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTSwitchLabel.java
index 1fdf6a135c..8391284ec8 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTSwitchLabel.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTSwitchLabel.java
@@ -23,9 +23,9 @@ import net.sourceforge.pmd.lang.ast.NodeStream;
*
*
*
- * Note: case null and the case patterns are a Java 19 Preview and Java 20 Preview language feature
+ * Note: case null and the case patterns are a Java 21 language feature
*
- * @see JEP 433: Pattern Matching for switch (Fourth Preview)
+ * @see JEP 441: Pattern Matching for switch
* @see JEP 432: Record Patterns (Second Preview)
*/
public final class ASTSwitchLabel extends AbstractJavaNode implements Iterable {
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/LanguageLevelChecker.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/LanguageLevelChecker.java
index 561965210c..98fd70a6b5 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/LanguageLevelChecker.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/LanguageLevelChecker.java
@@ -37,7 +37,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTResource;
import net.sourceforge.pmd.lang.java.ast.ASTStringLiteral;
import net.sourceforge.pmd.lang.java.ast.ASTSwitchArrowBranch;
import net.sourceforge.pmd.lang.java.ast.ASTSwitchExpression;
-import net.sourceforge.pmd.lang.java.ast.ASTSwitchGuard;
+import net.sourceforge.pmd.lang.java.ast.ASTGuard;
import net.sourceforge.pmd.lang.java.ast.ASTSwitchLabel;
import net.sourceforge.pmd.lang.java.ast.ASTTryStatement;
import net.sourceforge.pmd.lang.java.ast.ASTType;
@@ -550,7 +550,7 @@ public class LanguageLevelChecker {
}
@Override
- public Void visit(ASTSwitchGuard node, T data) {
+ public Void visit(ASTGuard node, T data) {
check(node, PreviewFeature.CASE_REFINEMENT, data);
return null;
}
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/GuardedAndParenthesizedPatterns.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/GuardedAndParenthesizedPatterns.txt
index 1af8bec44d..4cc8d4c987 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/GuardedAndParenthesizedPatterns.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/GuardedAndParenthesizedPatterns.txt
@@ -19,7 +19,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "length", @MethodName = "length", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
@@ -49,7 +49,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Integer", @TypeImage = "Integer"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "i", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "intValue", @MethodName = "intValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "i"]
@@ -67,7 +67,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Long", @TypeImage = "Long"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "l", @LambdaParameter = false, @LocalVariable = false, @Name = "l", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "l", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "longValue", @MethodName = "longValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "l", @Name = "l", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "l"]
@@ -153,7 +153,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 1, @Parenthesized = true]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "length", @MethodName = "length", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
@@ -183,7 +183,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Integer", @TypeImage = "Integer"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "i", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "intValue", @MethodName = "intValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "i"]
@@ -201,7 +201,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Long", @TypeImage = "Long"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "l", @LambdaParameter = false, @LocalVariable = false, @Name = "l", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "l", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 2, @Parenthesized = true]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "longValue", @MethodName = "longValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "l", @Name = "l", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "l"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/RefiningPatternsInSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/RefiningPatternsInSwitch.txt
index bda1bf2671..33e6549fb1 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/RefiningPatternsInSwitch.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/RefiningPatternsInSwitch.txt
@@ -107,7 +107,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Triangle", @TypeImage = "Triangle"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "t", @LambdaParameter = false, @LocalVariable = false, @Name = "t", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "t", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "calculateArea", @MethodName = "calculateArea", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "t", @Name = "t", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "t"]
@@ -149,7 +149,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Triangle", @TypeImage = "Triangle"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "t", @LambdaParameter = false, @LocalVariable = false, @Name = "t", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "t", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "calculateArea", @MethodName = "calculateArea", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "t", @Name = "t", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "t"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/ScopeOfPatternVariableDeclarations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/ScopeOfPatternVariableDeclarations.txt
index 2599595e42..24cebff346 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/ScopeOfPatternVariableDeclarations.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java20p/ScopeOfPatternVariableDeclarations.txt
@@ -19,7 +19,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Character", @TypeImage = "Character"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "c", @LambdaParameter = false, @LocalVariable = false, @Name = "c", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "c", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "charValue", @MethodName = "charValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "c", @Name = "c", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "c"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt
index 429344a8a3..e6548dec35 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt
@@ -19,7 +19,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "length", @MethodName = "length", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
@@ -49,7 +49,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Integer", @TypeImage = "Integer"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "i", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "intValue", @MethodName = "intValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "i"]
@@ -123,7 +123,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 1, @Parenthesized = true]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "length", @MethodName = "length", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
@@ -153,7 +153,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Integer", @TypeImage = "Integer"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "i", @LambdaParameter = false, @LocalVariable = false, @Name = "i", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "i", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "intValue", @MethodName = "intValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "i"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt
index c2a9f6bf54..8a825c5f46 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt
@@ -126,7 +126,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "equalsIgnoreCase", @MethodName = "equalsIgnoreCase", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
| | | +- ArgumentList[@Empty = false, @Size = 1]
@@ -145,7 +145,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "equalsIgnoreCase", @MethodName = "equalsIgnoreCase", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
| | | +- ArgumentList[@Empty = false, @Size = 1]
@@ -217,7 +217,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "equalsIgnoreCase", @MethodName = "equalsIgnoreCase", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
| | | +- ArgumentList[@Empty = false, @Size = 1]
@@ -236,7 +236,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "equalsIgnoreCase", @MethodName = "equalsIgnoreCase", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "s"]
| | | +- ArgumentList[@Empty = false, @Size = 1]
@@ -308,7 +308,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Suit", @TypeImage = "Suit"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "CLUBS", @Name = "CLUBS", @ParenthesisDepth = 0, @Parenthesized = false]
@@ -328,7 +328,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Suit", @TypeImage = "Suit"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "DIAMONDS", @Name = "DIAMONDS", @ParenthesisDepth = 0, @Parenthesized = false]
@@ -348,7 +348,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Suit", @TypeImage = "Suit"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "HEARTS", @Name = "HEARTS", @ParenthesisDepth = 0, @Parenthesized = false]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt
index bda1bf2671..33e6549fb1 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt
@@ -107,7 +107,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Triangle", @TypeImage = "Triangle"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "t", @LambdaParameter = false, @LocalVariable = false, @Name = "t", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "t", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "calculateArea", @MethodName = "calculateArea", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "t", @Name = "t", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "t"]
@@ -149,7 +149,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Triangle", @TypeImage = "Triangle"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "t", @LambdaParameter = false, @LocalVariable = false, @Name = "t", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "t", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "calculateArea", @MethodName = "calculateArea", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "t", @Name = "t", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "t"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt
index 2599595e42..24cebff346 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt
@@ -19,7 +19,7 @@
| | | | +- ModifierList[]
| | | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Character", @TypeImage = "Character"]
| | | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "c", @LambdaParameter = false, @LocalVariable = false, @Name = "c", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "c", @Visibility = Visibility.V_LOCAL, @Volatile = false]
- | | | +- SwitchGuard[]
+ | | | +- Guard[]
| | | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "charValue", @MethodName = "charValue", @ParenthesisDepth = 0, @Parenthesized = false]
| | | | +- AmbiguousName[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @CompileTimeConstant = false, @Expression = true, @Image = "c", @Name = "c", @ParenthesisDepth = 0, @Parenthesized = false, @PrimitiveType = false, @TypeImage = "c"]