Interface ASTExecutableDeclaration

All Superinterfaces:
Annotatable, ASTBodyDeclaration, net.sourceforge.pmd.lang.ast.impl.GenericNode<JavaNode>, JavadocCommentOwner, JavaNode, net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeNode<JavaNode>, ModifierOwner, net.sourceforge.pmd.lang.ast.Node, net.sourceforge.pmd.reporting.Reportable, ReturnScopeNode, SymbolDeclaratorNode, net.sourceforge.pmd.lang.ast.TextAvailableNode, TypeParamOwnerNode
All Known Implementing Classes:
ASTConstructorDeclaration, ASTMethodDeclaration

public interface ASTExecutableDeclaration extends ModifierOwner, ASTBodyDeclaration, TypeParamOwnerNode, JavadocCommentOwner, ReturnScopeNode
Groups method and constructor declarations under a common type.

 ExecutableDeclaration ::= MethodDeclaration
                         | ConstructorDeclaration

 

Note: This interface was called ASTMethodOrConstructorDeclaration in PMD 6.

Author:
Clément Fournier
Since:
5.8.1
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.ast.ModifierOwner

    ModifierOwner.Visibility
  • Field Summary

    Fields inherited from interface net.sourceforge.pmd.lang.ast.Node

    COORDS_COMPARATOR
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    Returns the number of formal parameters expected by this declaration.
    default @Nullable ASTBlock
    Returns the body of this method or constructor.
    default @NonNull ASTFormalParameters
    Returns the formal parameters node of this method or constructor.
    Returns the generic signature for the method.
    Returns the name of the method, or the simple name of the declaring class for a constructor declaration.
    Returns the symbol this node declares.
    default @Nullable ASTThrowsList
    Returns the throws clause of this declaration, or null if there is none.
    default boolean
    Returns true if this method is abstract, so doesn't declare a body.
    default boolean
    Returns true if this is a final method.
    default boolean
    Returns true if this is a static method.
    default boolean
    Returns true if this node's last formal parameter is varargs.

    Methods inherited from interface net.sourceforge.pmd.lang.java.ast.Annotatable

    getAnnotation, isAnnotationPresent, isAnnotationPresent, isAnyAnnotationPresent

    Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.GenericNode

    ancestors, ancestorsOrSelf, asStream, children, descendants, descendantsOrSelf, getChild, getFirstChild, getLastChild, getNextSibling, getParent, getPreviousSibling

    Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavadocCommentOwner

    getJavadocComment

    Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaNode

    getEnclosingType, getRoot, getSymbolTable, getTypeSystem

    Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeNode

    getFirstToken, getLastToken, tokens

    Methods inherited from interface net.sourceforge.pmd.lang.ast.Node

    acceptVisitor, ancestors, children, compareLocation, descendants, firstChild, getAstInfo, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getImage, getIndexInParent, getLanguageVersion, getNumChildren, getReportLocation, getTextDocument, getUserMap, getXPathAttributesIterator, getXPathNodeName, hasImageEqualTo, isFindBoundary

    Methods inherited from interface net.sourceforge.pmd.lang.ast.TextAvailableNode

    getOriginalText, getText, getTextRegion

    Methods inherited from interface net.sourceforge.pmd.lang.java.ast.TypeParamOwnerNode

    getTypeParameters
  • Method Details

    • getSymbol

      JExecutableSymbol getSymbol()
      Description copied from interface: SymbolDeclaratorNode
      Returns the symbol this node declares.
      Specified by:
      getSymbol in interface SymbolDeclaratorNode
      Specified by:
      getSymbol in interface TypeParamOwnerNode
    • getGenericSignature

      JMethodSig getGenericSignature()
      Returns the generic signature for the method. This is a JMethodSig declared in the generic type declaration of the enclosing type. The signature may mention type parameters of the enclosing types, and its own type parameters.
    • getName

      String getName()
      Returns the name of the method, or the simple name of the declaring class for a constructor declaration.
    • isAbstract

      default boolean isAbstract()
      Returns true if this method is abstract, so doesn't declare a body. Interface members are implicitly abstract, whether they declare the abstract modifier or not. Default interface methods are not abstract though, consistently with the standard reflection API.
    • getFormalParameters

      default @NonNull ASTFormalParameters getFormalParameters()
      Returns the formal parameters node of this method or constructor.
    • getArity

      default int getArity()
      Returns the number of formal parameters expected by this declaration. This excludes any receiver parameter, which is irrelevant to arity.
    • getBody

      default @Nullable ASTBlock getBody()
      Returns the body of this method or constructor. Returns null if this is the declaration of an abstract method.
      Specified by:
      getBody in interface ReturnScopeNode
    • getThrowsList

      default @Nullable ASTThrowsList getThrowsList()
      Returns the throws clause of this declaration, or null if there is none.
    • isVarargs

      default boolean isVarargs()
      Returns true if this node's last formal parameter is varargs.
    • isStatic

      default boolean isStatic()
      Returns true if this is a static method. If this is a constructor, return false.
      Since:
      7.1.0
    • isFinal

      default boolean isFinal()
      Returns true if this is a final method. If this is a constructor, return false.
      Since:
      7.1.0