Example usage for org.eclipse.jdt.internal.compiler.ast TypeDeclaration addMissingAbstractMethodFor

List of usage examples for org.eclipse.jdt.internal.compiler.ast TypeDeclaration addMissingAbstractMethodFor

Introduction

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

Prototype

public MethodDeclaration addMissingAbstractMethodFor(MethodBinding methodBinding) 

Source Link

Usage

From source file:lombok.eclipse.agent.PatchAutoGenMethodStub.java

License:Open Source License

public static MethodDeclaration addMissingAbstractMethodFor(final TypeDeclaration decl,
        final MethodBinding abstractMethod) {
    Annotation ann = getAnnotation(AutoGenMethodStub.class, decl);
    EclipseNode typeNode = getTypeNode(decl);
    if ((ann != null) && (typeNode != null)) {
        EclipseNode annotationNode = typeNode.getNodeFor(ann);
        try {//from  ww  w . j a  v  a2s . co  m
            MethodDeclaration method = new HandleAutoGenMethodStub().handle(abstractMethod,
                    createAnnotation(AutoGenMethodStub.class, annotationNode), ann, annotationNode);
            ISSUE_WAS_FIXED.set(true);
            return method;
        } catch (AnnotationValueDecodeFail fail) {
            fail.owner.setError(fail.getMessage(), fail.idx);
        }
    }
    return decl.addMissingAbstractMethodFor(abstractMethod);
}