Example usage for org.eclipse.jdt.internal.compiler.lookup ReferenceBinding isDefault

List of usage examples for org.eclipse.jdt.internal.compiler.lookup ReferenceBinding isDefault

Introduction

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

Prototype

public final boolean isDefault() 

Source Link

Document

Answer true if the receiver has default visibility

Usage

From source file:com.redhat.ceylon.eclipse.core.model.mirror.UnknownClassMirror.java

License:Open Source License

public JDTClass(ReferenceBinding klass, IType type) {
    this.type = type;
    bindingRef = new WeakReference<ReferenceBinding>(klass);
    pkg = new JDTPackage(klass.getPackage());
    simpleName = new String(klass.sourceName());
    qualifiedName = JDTUtils.getFullyQualifiedName(klass);
    isPublic = klass.isPublic();//w w  w. j a v  a  2s.c  om
    isInterface = klass.isInterface();
    isAbstract = klass.isAbstract();
    isProtected = klass.isProtected();
    isDefaultAccess = klass.isDefault();
    isLocalType = klass.isLocalType();
    isStatic = (klass.modifiers & ClassFileConstants.AccStatic) != 0;
    isFinal = klass.isFinal();
    isEnum = klass.isEnum();
    isBinary = klass.isBinaryBinding();
    isAnonymous = klass.isAnonymousType();
    isJavaSource = (klass instanceof SourceTypeBinding)
            && new String(((SourceTypeBinding) klass).getFileName()).endsWith(".java");
    isAnnotationType = klass.isAnnotationType();
    bindingKey = klass.computeUniqueKey();

    char[] bindingFileName = klass.getFileName();
    int start = CharOperation.lastIndexOf('/', bindingFileName) + 1;
    if (start == 0 || start < CharOperation.lastIndexOf('\\', bindingFileName))
        start = CharOperation.lastIndexOf('\\', bindingFileName) + 1;
    fileName = new String(CharOperation.subarray(bindingFileName, start, -1));

    int jarFileEntrySeparatorIndex = CharOperation.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR,
            bindingFileName);
    if (jarFileEntrySeparatorIndex > 0) {
        char[] jarPart = CharOperation.subarray(bindingFileName, 0, jarFileEntrySeparatorIndex);
        IJavaElement jarPackageFragmentRoot = JavaCore.create(new String(jarPart));
        String jarPath = jarPackageFragmentRoot.getPath().toOSString();
        char[] entryPart = CharOperation.subarray(bindingFileName, jarFileEntrySeparatorIndex + 1,
                bindingFileName.length);
        fullPath = new StringBuilder(jarPath).append("!/").append(entryPart).toString();
    } else {
        fullPath = new String(bindingFileName);
    }

    ReferenceBinding sourceOrClass = klass;
    if (!klass.isBinaryBinding()) {
        sourceOrClass = klass.outermostEnclosingType();
    }
    char[] classFullName = new char[0];
    for (char[] part : sourceOrClass.compoundName) {
        classFullName = CharOperation.concat(classFullName, part, '/');
    }
    char[][] temp = CharOperation.splitOn('.', sourceOrClass.getFileName());
    String extension = temp.length > 1 ? "." + new String(temp[temp.length - 1]) : "";
    javaModelPath = new String(classFullName) + extension;

    if (type == null) {
        annotations = new HashMap<>();
        methods = Collections.emptyList();
        interfaces = Collections.emptyList();
        typeParams = Collections.emptyList();
        fields = Collections.emptyList();
        innerClasses = Collections.emptyList();
    }
}