Class MethodDeclaration

java.lang.Object
Direct Known Subclasses:
InterTypeMethodDeclaration

public class MethodDeclaration extends BodyDeclaration
Method declaration AST node type. A method declaration is the union of a method declaration and a constructor declaration.
 MethodDeclaration:
    [ Javadoc ] { ExtendedModifier } [ < TypeParameter { , TypeParameter } > ] ( Type | void )
        Identifier (
            [ ReceiverParameter , ] [ FormalParameter { , FormalParameter } ]
        ) { Dimension }
        [ throws Type { , Type } ]
        ( Block | ; )
 ConstructorDeclaration:
    [ Javadoc ] { ExtendedModifier } [ < TypeParameter { , TypeParameter } > ]
        Identifier (
            [ ReceiverParameter , ] [ FormalParameter { , FormalParameter } ]
        ) { Dimension }
        [ throws Type { , Type } ]
        ( Block | ; )
 CompactConstructorDeclaration:
    [ Javadoc ] ExtendedModifier { ExtendedModifier}
        Identifier
        ( Block | ; )
 

The ReceiverParameter is represented as: Type [ SimpleName . ] this
The FormalParameter is represented by a SingleVariableDeclaration.

When a Javadoc comment is present, the source range begins with the first character of the "/**" comment delimiter. When there is no Javadoc comment, the source range begins with the first character of the first modifier keyword (if modifiers), or the first character of the "<" token (method, no modifiers, type parameters), or the first character of the return type (method, no modifiers, no type parameters), or the first character of the identifier (constructor, no modifiers). The source range extends through the last character of the ";" token (if no body), or the last character of the block (if body). The compact constructor must be declared public. (jls-8.10.5)

Since:
2.0