Example usage for org.eclipse.jdt.internal.compiler.lookup TypeConstants OBJECT

List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeConstants OBJECT

Introduction

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

Prototype

null OBJECT

To view the source code for org.eclipse.jdt.internal.compiler.lookup TypeConstants OBJECT.

Click Source Link

Usage

From source file:org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.java

License:Open Source License

private IType findSuperClass(IGenericType type, ReferenceBinding typeBinding) {
    ReferenceBinding superBinding = typeBinding.superclass();

    if (superBinding != null) {
        superBinding = (ReferenceBinding) superBinding.erasure();
        if (typeBinding.isHierarchyInconsistent()) {
            if (superBinding.problemId() == ProblemReasons.NotFound) {
                this.hasMissingSuperClass = true;
                this.builder.hierarchy.missingTypes.add(new String(superBinding.sourceName)); // note: this could be Map$Entry
                return null;
            } else if ((superBinding.id == TypeIds.T_JavaLangObject)) {
                char[] superclassName;
                char separator;
                if (type instanceof IBinaryType) {
                    superclassName = ((IBinaryType) type).getSuperclassName();
                    separator = '/';
                } else if (type instanceof ISourceType) {
                    superclassName = ((ISourceType) type).getSuperclassName();
                    separator = '.';
                } else if (type instanceof HierarchyType) {
                    superclassName = ((HierarchyType) type).superclassName;
                    separator = '.';
                } else {
                    return null;
                }/*from  ww  w. ja v a 2 s. co m*/

                if (superclassName != null) { // check whether subclass of Object due to broken hierarchy (as opposed to explicitly extending it)
                    int lastSeparator = CharOperation.lastIndexOf(separator, superclassName);
                    char[] simpleName = lastSeparator == -1 ? superclassName
                            : CharOperation.subarray(superclassName, lastSeparator + 1, superclassName.length);
                    if (!CharOperation.equals(simpleName, TypeConstants.OBJECT)) {
                        this.hasMissingSuperClass = true;
                        this.builder.hierarchy.missingTypes.add(new String(simpleName));
                        return null;
                    }
                }
            }
        }
        for (int t = this.typeIndex; t >= 0; t--) {
            if (this.typeBindings[t] == superBinding) {
                return this.builder.getHandle(this.typeModels[t], superBinding);
            }
        }
    }
    return null;
}