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

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

Introduction

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

Prototype

public boolean isNative() 

Source Link

Usage

From source file:com.google.gwt.dev.jdt.FindJsniRefVisitor.java

License:Apache License

@Override
public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
    if (!methodDeclaration.isNative()) {
        return false;
    }// ww  w  . j a  va2 s  .c o  m

    // Handle JSNI block
    String jsniCode = getJSNICode(methodDeclaration);
    if (jsniCode == null) {
        return false;
    }
    if (jsniCode.indexOf('@') < 0) {
        // short cut: if there are no at signs, there are no JSNI refs
        return false;
    }

    findJsniRefsAccurately(methodDeclaration, jsniCode);
    return false;
}

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

License:Open Source License

public void parse(MethodDeclaration md, CompilationUnitDeclaration unit) {
    //only parse the method body of md
    //fill out method statements

    //convert bugs into parse error

    if (md.isAbstract())
        return;/*w w  w . j a v a  2 s.  co m*/
    if (md.isNative())
        return;
    if ((md.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0)
        return;

    boolean oldMethodRecoveryActivated = this.methodRecoveryActivated;
    if (this.options.performMethodsFullRecovery) {
        this.methodRecoveryActivated = true;
        this.rParenPos = md.sourceEnd;
    }
    initialize();
    goForBlockStatementsopt();
    this.nestedMethod[this.nestedType]++;
    pushOnRealBlockStack(0);

    this.referenceContext = md;
    this.compilationUnit = unit;

    this.scanner.resetTo(md.bodyStart, md.bodyEnd);
    // reset the scanner to parser from { down to }
    try {
        parse();
    } catch (AbortCompilation ex) {
        this.lastAct = ERROR_ACTION;
    } finally {
        this.nestedMethod[this.nestedType]--;
        if (this.options.performStatementsRecovery) {
            this.methodRecoveryActivated = oldMethodRecoveryActivated;
        }
    }

    checkNonNLSAfterBodyEnd(md.declarationSourceEnd);

    if (this.lastAct == ERROR_ACTION) {
        md.bits |= ASTNode.HasSyntaxErrors;
        return;
    }

    //refill statements
    md.explicitDeclarations = this.realBlockStack[this.realBlockPtr--];
    int length;
    if (this.astLengthPtr > -1 && (length = this.astLengthStack[this.astLengthPtr--]) != 0) {
        if (this.options.ignoreMethodBodies) {
            // ignore statements
            this.astPtr -= length;
        } else {
            System.arraycopy(this.astStack, (this.astPtr -= length) + 1, md.statements = new Statement[length],
                    0, length);
        }
    } else {
        if (!containsComment(md.bodyStart, md.bodyEnd)) {
            md.bits |= ASTNode.UndocumentedEmptyBlock;
        }
    }
}