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

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

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast AbstractMethodDeclaration 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 consumeEmptyMethodHeaderDefaultValue() {
    // DefaultValueopt ::= $empty
    AbstractMethodDeclaration method = (AbstractMethodDeclaration) this.astStack[this.astPtr];
    if (method.isAnnotationMethod()) { //'method' can be a MethodDeclaration when recovery is started
        pushOnExpressionStackLengthStack(0);
    }//from   w  w w . j  av  a 2 s.co m
    this.recordStringLiterals = true;
}

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

License:Open Source License

private void reportSyntaxErrorsForSkippedMethod(TypeDeclaration[] types) {
    if (types != null) {
        for (int i = 0; i < types.length; i++) {
            TypeDeclaration[] memberTypes = types[i].memberTypes;
            if (memberTypes != null) {
                reportSyntaxErrorsForSkippedMethod(memberTypes);
            }//from  ww w.  j a v  a  2 s. c  o  m

            AbstractMethodDeclaration[] methods = types[i].methods;
            if (methods != null) {
                for (int j = 0; j < methods.length; j++) {
                    AbstractMethodDeclaration method = methods[j];
                    if ((method.bits & ASTNode.ErrorInSignature) != 0) {
                        if (method.isAnnotationMethod()) {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameQUESTION,
                                    method.declarationSourceStart, method.declarationSourceEnd, this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        } else {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameDIVIDE,
                                    method.declarationSourceStart, method.declarationSourceEnd, this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        }

                    }
                }
            }

            FieldDeclaration[] fields = types[i].fields;
            if (fields != null) {
                int length = fields.length;
                for (int j = 0; j < length; j++) {
                    if (fields[j] instanceof Initializer) {
                        Initializer initializer = (Initializer) fields[j];
                        if ((initializer.bits & ASTNode.ErrorInSignature) != 0) {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameRIGHT_SHIFT,
                                    initializer.declarationSourceStart, initializer.declarationSourceEnd,
                                    this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        }
                    }
                }
            }
        }
    }
}