diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 56fac4c041..53663fa57a 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1743,7 +1743,7 @@ void TypePattern(): } void RecordPattern(): -{ checkForRecordPatterns(); } +{} { ReferenceType() RecordStructurePattern() [ VariableDeclaratorId() ] } @@ -2476,7 +2476,6 @@ void CaseLabelElement(ASTSwitchLabel label) #void: void Guard() #SwitchGuard: { Token t; - checkForGuard(); } { t = { diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTComponentPatternList.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTComponentPatternList.java index 6fded4c6ab..d0f3bcfd5a 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTComponentPatternList.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTComponentPatternList.java @@ -19,17 +19,13 @@ import net.sourceforge.pmd.annotation.Experimental; * @see JEP 405: Record Patterns (Preview) */ @Experimental -public final class ASTComponentPatternList extends AbstractJavaNode { +public final class ASTComponentPatternList extends ASTList { ASTComponentPatternList(int id) { - super(id); - } - - ASTComponentPatternList(JavaParser p, int id) { - super(p, id); + super(id, ASTPattern.class); } @Override - public Object jjtAccept(JavaParserVisitor visitor, Object data) { + protected R acceptVisitor(JavaVisitor visitor, P data) { return visitor.visit(this, data); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordPattern.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordPattern.java index 6db0e82d6b..d646dbfd13 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordPattern.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordPattern.java @@ -26,13 +26,8 @@ public final class ASTRecordPattern extends AbstractJavaNode implements ASTPatte super(id); } - ASTRecordPattern(JavaParser p, int id) { - super(p, id); - } - - @Override - public Object jjtAccept(JavaParserVisitor visitor, Object data) { + protected R acceptVisitor(JavaVisitor visitor, P data) { return visitor.visit(this, data); } 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/ASTSwitchGuard.java index b59332f2a1..af173bcba0 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/ASTSwitchGuard.java @@ -25,13 +25,8 @@ public final class ASTSwitchGuard extends AbstractJavaNode { super(id); } - ASTSwitchGuard(JavaParser p, int id) { - super(p, id); - } - - @Override - public Object jjtAccept(JavaParserVisitor visitor, Object data) { + protected R acceptVisitor(JavaVisitor visitor, P data) { return visitor.visit(this, data); } 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 1e8c80cd5d..fee0454ad4 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 @@ -18,7 +18,7 @@ import net.sourceforge.pmd.lang.java.JavaParsingHelper; public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest { private final JavaParsingHelper java19p = - JavaParsingHelper.WITH_PROCESSING.withDefaultVersion("19-preview") + JavaParsingHelper.DEFAULT.withDefaultVersion("19-preview") .withResourceContext(Java19PreviewTreeDumpTest.class, "jdkversiontests/java19p/"); private final JavaParsingHelper java19 = java19p.withDefaultVersion("19");