Example usage for org.eclipse.jdt.internal.compiler.ast MethodDeclaration isAnnotationMethod

List of usage examples for org.eclipse.jdt.internal.compiler.ast MethodDeclaration isAnnotationMethod

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast MethodDeclaration isAnnotationMethod.

Prototype

public boolean isAnnotationMethod() 

Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumeMethodHeaderDefaultValue() {
    // MethodHeaderDefaultValue ::= DefaultValue
    MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];

    int length = this.expressionLengthStack[this.expressionLengthPtr--];
    if (length == 1) {
        this.intPtr--; // we get rid of the position of the default keyword
        this.intPtr--; // we get rid of the position of the default keyword
        if (md.isAnnotationMethod()) {
            ((AnnotationMethodDeclaration) md).defaultValue = this.expressionStack[this.expressionPtr];
            md.modifiers |= ClassFileConstants.AccAnnotationDefault;
        }/*w  ww  . j  av  a  2  s .com*/
        this.expressionPtr--;
        this.recordStringLiterals = true;
    }

    if (this.currentElement != null) {
        if (md.isAnnotationMethod()) {
            this.currentElement
                    .updateSourceEndIfNecessary(((AnnotationMethodDeclaration) md).defaultValue.sourceEnd);
        }
    }
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumeMethodHeaderExtendedDims() {
    // MethodHeaderExtendedDims ::= Dimsopt
    // now we update the returnType of the method
    MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
    int extendedDims = this.intStack[this.intPtr--];
    if (md.isAnnotationMethod()) {
        ((AnnotationMethodDeclaration) md).extendedDimensions = extendedDims;
    }// w w w. jav  a  2  s  .com
    if (extendedDims != 0) {
        TypeReference returnType = md.returnType;
        md.sourceEnd = this.endPosition;
        int dims = returnType.dimensions() + extendedDims;
        md.returnType = copyDims(returnType, dims);
        if (this.currentToken == TokenNameLBRACE) {
            md.bodyStart = this.endPosition + 1;
        }
        // recovery
        if (this.currentElement != null) {
            this.lastCheckPoint = md.bodyStart;
        }
    }
}