net.sourceforge.pmd.lang.java.ast.ASTArrayDimensions Maven / Gradle / Ivy
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.lang.java.ast.ASTList.ASTNonEmptyList;
/**
* Represents array type dimensions. This node may occur in several contexts:
*
* - In an {@linkplain ASTArrayType array type}
* - As the {@linkplain ASTMethodDeclaration#getExtraDimensions() extra dimensions of a method declaration},
* after the formal parameter list. For example:
*
public int newIntArray(int length) [];
*
* - As the {@linkplain ASTVariableId#getExtraDimensions() extra dimensions of a variable declarator id},
* in a {@linkplain ASTVariableDeclarator variable declarator}. For example:
*
public int a[], b[][];
*
*
*
* Some dimensions may be initialized with an expression, but only in
* the array type of an {@linkplain ASTArrayAllocation array allocation expression}.
*
*
*
* ArrayDimensions ::= {@link ASTArrayTypeDim ArrayTypeDim}+ {@link ASTArrayDimExpr ArrayDimExpr}*
*
*
*/
public final class ASTArrayDimensions extends ASTNonEmptyList {
ASTArrayDimensions(int id) {
super(id, ASTArrayTypeDim.class);
}
@Override
protected R acceptVisitor(JavaVisitor super P, ? extends R> visitor, P data) {
return visitor.visit(this, data);
}
}