Class ASTFormalParameter

java.lang.Object
net.sourceforge.pmd.lang.ast.impl.AbstractNode<B,N>
net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
net.sourceforge.pmd.lang.java.ast.ASTFormalParameter
All Implemented Interfaces:
GenericNode<JavaNode>, JjtreeNode<JavaNode>, Node, TextAvailableNode, Annotatable, JavaNode, ModifierOwner, TypeNode, Reportable

public final class ASTFormalParameter extends AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode> implements ModifierOwner, TypeNode
Formal parameter node for a formal parameter list. This is distinct from lambda parameters.

The varargs ellipsis "..." is parsed as an array dimension in the type node.


 FormalParameter ::= LocalVarModifierList Type VariableId

 
  • Field Details

  • Method Details

    • getVisibility

      public ModifierOwner.Visibility getVisibility()
      Description copied from interface: ModifierOwner
      Returns the visibility corresponding to the effective modifiers. Eg a public method will have visibility public, a local class will have visibility local. There cannot be any conflict with ModifierOwner.hasModifiers(JModifier, JModifier...)} on well-formed code (e.g. for any n, (n.getVisibility() == V_PROTECTED) == n.hasModifiers(PROTECTED))

      TODO a public method of a private class can be considered to be private we could probably add another method later on that takes this into account

      Specified by:
      getVisibility in interface ModifierOwner
    • getOwnerList

      public ASTFormalParameters getOwnerList()
      Returns the list of formal parameters containing this param.
    • isVarargs

      public boolean isVarargs()
      Returns true if this node is a varargs parameter. Then, the type node is an ArrayType, and its last dimension is varargs.
    • acceptVisitor

      protected <P, R> R acceptVisitor(JavaVisitor<? super P,? extends R> visitor, P data)
    • getVarId

      public @NonNull ASTVariableId getVarId()
      Returns the declarator ID of this formal parameter.
    • getTypeNode

      public ASTType getTypeNode()
      Returns the type node of this formal parameter.

      If this formal parameter is varargs, the type node is an ASTArrayType.

    • getTypeMirror

      public @NonNull JTypeMirror getTypeMirror(TypingContext ctx)
      Specified by:
      getTypeMirror in interface TypeNode
    • isFinal

      public boolean isFinal()
    • jjtClose

      public void jjtClose()
      Overrides:
      jjtClose in class AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • acceptVisitor

      public final <P, R> R acceptVisitor(AstVisitor<? super P,? extends R> visitor, P data)
      Specified by:
      acceptVisitor in interface Node
    • addChild

      protected void addChild(net.sourceforge.pmd.lang.java.ast.AbstractJavaNode child, int index)
      Overrides:
      addChild in class AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • insertChild

      protected void insertChild(net.sourceforge.pmd.lang.java.ast.AbstractJavaNode child, int index)
      Overrides:
      insertChild in class AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • removeChildAtIndex

      protected void removeChildAtIndex(int childIndex)
      Overrides:
      removeChildAtIndex in class AbstractNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • setImage

      protected void setImage(String image)
      Overrides:
      setImage in class AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • setFirstToken

      protected void setFirstToken(JavaccToken token)
      Overrides:
      setFirstToken in class AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • setLastToken

      protected void setLastToken(JavaccToken token)
      Overrides:
      setLastToken in class AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • enlargeLeft

      protected void enlargeLeft(JavaccToken child)
      Overrides:
      enlargeLeft in class AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • setChild

      protected void setChild(net.sourceforge.pmd.lang.java.ast.AbstractJavaNode child, int index)
      Overrides:
      setChild in class AbstractNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
    • getSymbolTable

      public @NonNull JSymbolTable getSymbolTable()
      Description copied from interface: JavaNode
      Returns the symbol table for the program point represented by this node.
      Specified by:
      getSymbolTable in interface JavaNode
    • getTypeSystem

      public TypeSystem getTypeSystem()
      Description copied from interface: JavaNode
      Returns the type system with which this node was created. This is the object responsible for representing types in the compilation unit.
      Specified by:
      getTypeSystem in interface JavaNode
    • getRoot

      public final @NonNull ASTCompilationUnit getRoot()
      Specified by:
      getRoot in interface JavaNode
      Specified by:
      getRoot in interface Node
    • getXPathNodeName

      public final String getXPathNodeName()
      Specified by:
      getXPathNodeName in interface Node