Skip to content

Commit

Permalink
[java] RecordComponents -> RecordComponentList
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Feb 28, 2020
1 parent e2d84d6 commit 9917e3f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions pmd-java/etc/grammar/Java.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -1131,15 +1131,15 @@ void RecordDeclaration(int modifiers):
}
t=<IDENTIFIER> {checkForBadTypeIdentifierUsage(t.image); jjtThis.setImage(t.image);}
[ TypeParameters() ]
"(" RecordComponents() ")"
RecordComponentList()
[ ImplementsList() ]
RecordBody()
}

void RecordComponents() :
void RecordComponentList() :
{}
{
RecordComponent() ("," RecordComponent())*
"(" RecordComponent() ("," RecordComponent())* ")"
}

void RecordComponent():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
*
* <pre class="grammar">
*
* RecordComponents ::= {@linkplain ASTRecordComponent RecordComponent} ( "," {@linkplain ASTRecordComponent RecordComponent} )*
* RecordComponentList ::= "(" {@linkplain ASTRecordComponent RecordComponent}
* ( "," {@linkplain ASTRecordComponent RecordComponent} )* ")"
*
* </pre>
*/
@Experimental
public class ASTRecordComponents extends AbstractJavaNode {
ASTRecordComponents(int id) {
public class ASTRecordComponentList extends AbstractJavaNode {
ASTRecordComponentList(int id) {
super(id);
}

ASTRecordComponents(JavaParser p, int id) {
ASTRecordComponentList(JavaParser p, int id) {
super(p, id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* RecordDeclaration ::= "record"
* &lt;IDENTIFIER&gt;
* {@linkplain ASTTypeParameters TypeParameters}?
* "(" {@linkplain ASTRecordComponents RecordComponents} ")"
* {@linkplain ASTRecordComponentList RecordComponents}
* {@linkplain ASTImplementsList ImplementsList}?
* {@linkplain ASTRecordBody RecordBody}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ public Object visit(ASTRecordDeclaration node, Object data) {

@Override
@Experimental
public Object visit(ASTRecordComponents node, Object data) {
public Object visit(ASTRecordComponentList node, Object data) {
visitor.visit(node, data);
return visit((JavaNode) node, data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public Object visit(ASTRecordDeclaration node, Object data) {

@Override
@Experimental
public Object visit(ASTRecordComponents node, Object data) {
public Object visit(ASTRecordComponentList node, Object data) {
return visit((JavaNode) node, data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ public Object visit(ASTRecordDeclaration node, Object data) {

@Override
@Experimental
public Object visit(ASTRecordComponents node, Object data) {
public Object visit(ASTRecordComponentList node, Object data) {
return visitor.visit(node, data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
import net.sourceforge.pmd.lang.java.ast.ASTRecordBody;
import net.sourceforge.pmd.lang.java.ast.ASTRecordBodyDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTRecordComponent;
import net.sourceforge.pmd.lang.java.ast.ASTRecordComponents;
import net.sourceforge.pmd.lang.java.ast.ASTRecordComponentList;
import net.sourceforge.pmd.lang.java.ast.ASTRecordConstructorDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTRecordDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTReferenceType;
Expand Down Expand Up @@ -857,7 +857,7 @@ public Object visit(ASTRecordDeclaration node, Object data) {

@Override
@Experimental
public Object visit(ASTRecordComponents node, Object data) {
public Object visit(ASTRecordComponentList node, Object data) {
return visit((JavaNode) node, data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void recordPoint() {
ASTCompilationUnit compilationUnit = java14p.parseResource("Point.java");
ASTRecordDeclaration recordDecl = compilationUnit.getFirstDescendantOfType(ASTRecordDeclaration.class);
Assert.assertEquals("Point", recordDecl.getImage());
List<ASTRecordComponent> components = recordDecl.getFirstChildOfType(ASTRecordComponents.class)
List<ASTRecordComponent> components = recordDecl.getFirstChildOfType(ASTRecordComponentList.class)
.findChildrenOfType(ASTRecordComponent.class);
Assert.assertEquals(2, components.size());
Assert.assertEquals("x", components.get(0).getImage());
Expand Down

0 comments on commit 9917e3f

Please sign in to comment.