From 2e1e0ed3a446b7d0e16555e265c9ad7c04a71c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 22 Aug 2020 19:30:38 +0200 Subject: [PATCH] Rename PermittedSubclasses to PermitsList --- pmd-java/etc/grammar/Java.jjt | 2 +- .../pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java | 2 +- .../{ASTPermittedSubclasses.java => ASTPermitsList.java} | 7 ++++--- .../pmd/lang/java/ast/JavaParserDecoratedVisitor.java | 2 +- .../pmd/lang/java/ast/JavaParserVisitorAdapter.java | 2 +- .../pmd/lang/java/ast/JavaParserVisitorDecorator.java | 2 +- .../sourceforge/pmd/lang/java/rule/AbstractJavaRule.java | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) rename pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/{ASTPermittedSubclasses.java => ASTPermitsList.java} (82%) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 4ba4da5471..06eb097dce 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1205,7 +1205,7 @@ void ImplementsList(): ( "," (TypeAnnotation())* ClassOrInterfaceType() )* } -void PermittedSubclasses(): +void PermittedSubclasses() #PermitsList: { Token t; checkForSealedClassUsage(); diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java index 1216b96fca..54e12a590d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java @@ -144,7 +144,7 @@ public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration { @Experimental public List getPermittedSubclasses() { - ASTPermittedSubclasses permitted = getFirstChildOfType(ASTPermittedSubclasses.class); + ASTPermitsList permitted = getFirstChildOfType(ASTPermitsList.class); return permitted == null ? Collections.emptyList() : CollectionUtil.toList(permitted.iterator()); diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermittedSubclasses.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermitsList.java similarity index 82% rename from pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermittedSubclasses.java rename to pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermitsList.java index afdb68b442..541a0f812c 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermittedSubclasses.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTPermitsList.java @@ -17,18 +17,19 @@ import net.sourceforge.pmd.annotation.Experimental; *

See https://openjdk.java.net/jeps/360 * *

+ *
  *  PermittedSubclasses ::= "permits" (TypeAnnotation)* ClassOrInterfaceType
  *                ( "," (TypeAnnotation)* ClassOrInterfaceType )*
  * 
*/ @Experimental -public final class ASTPermittedSubclasses extends AbstractJavaNode implements Iterable { +public final class ASTPermitsList extends AbstractJavaNode implements Iterable { - ASTPermittedSubclasses(int id) { + ASTPermitsList(int id) { super(id); } - ASTPermittedSubclasses(JavaParser p, int id) { + ASTPermitsList(JavaParser p, int id) { super(p, id); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java index 59c4ac6071..ecc15eacd9 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.java @@ -945,7 +945,7 @@ public class JavaParserDecoratedVisitor implements JavaParserVisitor { @Override @Experimental - public Object visit(ASTPermittedSubclasses node, Object data) { + public Object visit(ASTPermitsList node, Object data) { visitor.visit(node, data); return visit((JavaNode) node, data); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java index a751ca07af..359cd8573e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.java @@ -666,7 +666,7 @@ public class JavaParserVisitorAdapter implements JavaParserVisitor { @Override @Experimental - public Object visit(ASTPermittedSubclasses node, Object data) { + public Object visit(ASTPermitsList node, Object data) { return visit((JavaNode) node, data); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java index e25d835e14..fef4a1bb7f 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.java @@ -798,7 +798,7 @@ public class JavaParserVisitorDecorator implements JavaParserControllessVisitor @Override @Experimental - public Object visit(ASTPermittedSubclasses node, Object data) { + public Object visit(ASTPermitsList node, Object data) { return visitor.visit(node, data); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java index 722ae15fda..294eb61ee8 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJavaRule.java @@ -87,7 +87,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTNameList; import net.sourceforge.pmd.lang.java.ast.ASTNormalAnnotation; import net.sourceforge.pmd.lang.java.ast.ASTNullLiteral; import net.sourceforge.pmd.lang.java.ast.ASTPackageDeclaration; -import net.sourceforge.pmd.lang.java.ast.ASTPermittedSubclasses; +import net.sourceforge.pmd.lang.java.ast.ASTPermitsList; import net.sourceforge.pmd.lang.java.ast.ASTPostfixExpression; import net.sourceforge.pmd.lang.java.ast.ASTPreDecrementExpression; import net.sourceforge.pmd.lang.java.ast.ASTPreIncrementExpression; @@ -875,7 +875,7 @@ public abstract class AbstractJavaRule extends AbstractRule implements JavaParse @Override @Experimental - public Object visit(ASTPermittedSubclasses node, Object data) { + public Object visit(ASTPermitsList node, Object data) { return visit((JavaNode) node, data); } }