private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeName, boolean asBinaryOnly){ NameEnvironmentAnswer answer = internalFindClass(qualifiedTypeName, typeName, asBinaryOnly); if (this.annotationsFromClasspath && answer != null && answer.getBinaryType() instanceof ClassFileReader) { for (int i = 0, length = this.classpaths.length; i < length; i++) { Classpath classpathEntry = this.classpaths[i]; if (classpathEntry.hasAnnotationFileFor(qualifiedTypeName)) { ZipFile zip = classpathEntry instanceof ClasspathJar ? ((ClasspathJar) classpathEntry).zipFile : null; try { ((ClassFileReader) answer.getBinaryType()).setExternalAnnotationProvider(classpathEntry.getPath(), qualifiedTypeName, zip, null); break; } catch (IOException e) { // ignore broken entry, keep searching } } } } return answer; } private NameEnvironmentAnswer internalFindClass(String qualifiedTypeName, char[] typeName, boolean asBinaryOnly){
private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeName, boolean asBinaryOnly){ NameEnvironmentAnswer answer = internalFindClass(qualifiedTypeName, typeName, asBinaryOnly); if (this.annotationsFromClasspath && answer != null && answer.getBinaryType() instanceof ClassFileReader) { for (int i = 0, length = this.classpaths.length; i < length; i++) { Classpath classpathEntry = this.classpaths[i]; if (classpathEntry.hasAnnotationFileFor(qualifiedTypeName)) { ZipFile zip = classpathEntry instanceof ClasspathJar ? ((ClasspathJar) classpathEntry).zipFile : null; try { ((ClassFileReader) answer.getBinaryType()).setExternalAnnotationProvider(classpathEntry.getPath(), qualifiedTypeName, zip, null); break; } catch (IOException e) { // ignore broken entry, keep searching } } } } return answer; } private NameEnvironmentAnswer internalFindClass(String qualifiedTypeName, char[] typeName, boolean asBinaryOnly){
private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeName, boolean asBinaryOnly){ NameEnvironmentAnswer answer = internalFindClass(qualifiedTypeName, typeName, asBinaryOnly); if (this.annotationsFromClasspath && answer != null && answer.getBinaryType() instanceof ClassFileReader) { for (int i = 0, length = this.classpaths.length; i < length; i++) { Classpath classpathEntry = this.classpaths[i]; if (classpathEntry.hasAnnotationFileFor(qualifiedTypeName)) { ZipFile zip = classpathEntry instanceof ClasspathJar ? ((ClasspathJar) classpathEntry).zipFile : null; try { ((ClassFileReader) answer.getBinaryType()).setExternalAnnotationProvider(classpathEntry.getPath(), qualifiedTypeName, zip, null); break; } catch (IOException e) { // ignore broken entry, keep searching } } } } return answer; } private NameEnvironmentAnswer internalFindClass(String qualifiedTypeName, char[] typeName, boolean asBinaryOnly){
ReferenceBinding askForType(PackageBinding packageBinding, char[] name) { if (packageBinding == null) { if (this.defaultPackage == null) return null; packageBinding = this.defaultPackage; } NameEnvironmentAnswer answer = this.nameEnvironment.findType(name, packageBinding.compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction()); } return packageBinding.getType0(name); }
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
ReferenceBinding askForType(PackageBinding packageBinding, char[] name) { if (packageBinding == null) { packageBinding = this.defaultPackage; } NameEnvironmentAnswer answer = this.nameEnvironment.findType(name, packageBinding.compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache try { this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } catch (AbortCompilation abort) { if (CharOperation.equals(name, TypeConstants.PACKAGE_INFO_NAME)) return null; // silently, requestor may not be able to handle compilation units (HierarchyResolver) throw abort; } } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction()); } return packageBinding.getType0(name); }
ReferenceBinding askForType(PackageBinding packageBinding, char[] name) { if (packageBinding == null) { packageBinding = this.defaultPackage; } NameEnvironmentAnswer answer = this.nameEnvironment.findType(name, packageBinding.compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache try { this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } catch (AbortCompilation abort) { if (CharOperation.equals(name, TypeConstants.PACKAGE_INFO_NAME)) return null; // silently, requestor may not be able to handle compilation units (HierarchyResolver) throw abort; } } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction()); } return packageBinding.getType0(name); }
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
ReferenceBinding askForType(PackageBinding packageBinding, char[] name) { if (packageBinding == null) { packageBinding = this.defaultPackage; } NameEnvironmentAnswer answer = this.nameEnvironment.findType(name, packageBinding.compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache try { this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } catch (AbortCompilation abort) { if (CharOperation.equals(name, TypeConstants.PACKAGE_INFO_NAME)) return null; // silently, requestor may not be able to handle compilation units (HierarchyResolver) throw abort; } } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction()); } return packageBinding.getType0(name); }
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
/** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. */ public ReferenceBinding askForType(char[][] compoundName) { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), computePackageFrom(compoundName, false /* valid pkg */), answer.getAccessRestriction()); } return getCachedType(compoundName); } /* Ask the oracle for a type named name in the packageBinding.
ReferenceBinding askForType(PackageBinding packageBinding, char[] name) { if (packageBinding == null) { packageBinding = this.defaultPackage; } NameEnvironmentAnswer answer = this.nameEnvironment.findType(name, packageBinding.compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache try { this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } catch (AbortCompilation abort) { if (CharOperation.equals(name, TypeConstants.PACKAGE_INFO_NAME)) return null; // silently, requestor may not be able to handle compilation units (HierarchyResolver) throw abort; } } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction()); } return packageBinding.getType0(name); }
ReferenceBinding askForType(PackageBinding packageBinding, char[] name) { if (packageBinding == null) { packageBinding = this.defaultPackage; } NameEnvironmentAnswer answer = this.nameEnvironment.findType(name, packageBinding.compoundName); if (answer == null) return null; if (answer.isBinaryType()) { // the type was found as a .class file this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) { // the type was found as a .java file, try to build it then search the cache try { this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction()); } catch (AbortCompilation abort) { if (CharOperation.equals(name, TypeConstants.PACKAGE_INFO_NAME)) return null; // silently, requestor may not be able to handle compilation units (HierarchyResolver) throw abort; } } else if (answer.isSourceType()) { // the type was found as a source model this.typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction()); } return packageBinding.getType0(name); }
this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) {
this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction()); } else if (answer.isCompilationUnit()) {