Example usage for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding implementsInterface

List of usage examples for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding implementsInterface

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding implementsInterface.

Prototype

public boolean implementsInterface(ReferenceBinding anInterface, boolean searchHierarchy) 

Source Link

Document

Answer true if the receiver implements anInterface or is identical to anInterface.

Usage

From source file:org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitScope.java

License:Open Source License

/**
 * Ensure Groovy types extend groovy.lang.GroovyObject
 *//*ww  w. ja v a2s. c o m*/
private void augmentTypeHierarchy(SourceTypeBinding typeBinding) {
    if (typeBinding.isAnnotationType() || typeBinding.isInterface()) {
        return;
    }
    ReferenceBinding groovyLangObjectBinding = getGroovyLangObjectBinding();
    if (!typeBinding.implementsInterface(groovyLangObjectBinding, true)) {
        ReferenceBinding[] superInterfaceBindings = typeBinding.superInterfaces;
        if (superInterfaceBindings != null) {
            int count = superInterfaceBindings.length;
            System.arraycopy(superInterfaceBindings, 0,
                    superInterfaceBindings = new ReferenceBinding[count + 1], 0, count);
            superInterfaceBindings[count] = groovyLangObjectBinding;
            typeBinding.superInterfaces = superInterfaceBindings;
        }
    }
}