Example usage for org.eclipse.jdt.core ITypeHierarchy getCachedFlags

List of usage examples for org.eclipse.jdt.core ITypeHierarchy getCachedFlags

Introduction

In this page you can find the example usage for org.eclipse.jdt.core ITypeHierarchy getCachedFlags.

Prototype

int getCachedFlags(IType type);

Source Link

Document

Return the flags associated with the given type (would be equivalent to IMember.getFlags()), or -1 if this information wasn't cached on the hierarchy during its computation.

Usage

From source file:org.eclipse.jst.j2ee.internal.common.operations.JavaModelUtil.java

License:Open Source License

public static boolean isSuperType(ITypeHierarchy hierarchy, IType possibleSuperType, IType type) {
    // filed bug 112635 to add this method to ITypeHierarchy
    IType superClass = hierarchy.getSuperclass(type);
    if (superClass != null && (possibleSuperType.equals(superClass)
            || isSuperType(hierarchy, possibleSuperType, superClass))) {
        return true;
    }/*from   w ww .ja v a  2  s. c  om*/
    if (Flags.isInterface(hierarchy.getCachedFlags(possibleSuperType))) {
        IType[] superInterfaces = hierarchy.getSuperInterfaces(type);
        for (int i = 0; i < superInterfaces.length; i++) {
            IType curr = superInterfaces[i];
            if (possibleSuperType.equals(curr) || isSuperType(hierarchy, possibleSuperType, curr)) {
                return true;
            }
        }
    }
    return false;
}