Interface MethodTree

All Superinterfaces:
Tree
All Known Implementing Classes:
MethodTreeImpl

@Beta public interface MethodTree extends Tree
Method or annotation type element declaration.

JLS 8.8. Constructor (Tree.Kind.CONSTRUCTOR):

   modifiers() typeParameters() simpleName() ( parameters() ) throws throwsClauses() block()
 
JLS 8.4, 9.4. Method (Tree.Kind.METHOD):
   modifiers() typeParameters() returnType() simpleName() ( parameters() ) throws throwsClauses() block()
 
JLS 9.6.1, 9.6.2. Annotation type element (Tree.Kind.METHOD):
   modifiers() returnType() simpleName() default defaultValue() ;
 

Since:
Java 1.3
  • Method Details

    • modifiers

      ModifiersTree modifiers()
    • typeParameters

      TypeParameters typeParameters()
    • returnType

      @Nullable TypeTree returnType()
      Returns:
      null in case of constructor
    • simpleName

      IdentifierTree simpleName()
    • openParenToken

      @Nullable SyntaxToken openParenToken()
      Returns:
      null in case of compact constructor in records
    • parameters

      List<VariableTree> parameters()
    • closeParenToken

      @Nullable SyntaxToken closeParenToken()
      Returns:
      null in case of compact constructor in records
    • throwsToken

      SyntaxToken throwsToken()
    • throwsClauses

      ListTree<TypeTree> throwsClauses()
    • block

      @Nullable BlockTree block()
    • semicolonToken

      @Nullable SyntaxToken semicolonToken()
    • defaultToken

      @Nullable SyntaxToken defaultToken()
      Since:
      Java 1.5
    • defaultValue

      @Nullable ExpressionTree defaultValue()
      Since:
      Java 1.5
    • symbol

    • isOverriding

      @Nullable Boolean isOverriding()
      Check if a methodTree is overriding any other method. The corresponding overridden symbol can be retrieved through the symbol().
      Returns:
      true if overriding, null if it cannot be decided (method symbol not resolved or lack of byte code for super types), false if not overriding.
    • cfg

      @Nullable ControlFlowGraph cfg()
      Compute a CFG for a given method.
      Returns:
      null if the method as no body. Otherwise the corresponding CFG.