public boolean hasCompilationUnit(boolean checkCUs) { if (this.knownTypes != null) { for (ReferenceBinding knownType : this.knownTypes.valueTable) { if (knownType != null && knownType != LookupEnvironment.TheNotFoundType) return true; } } if (this.environment.useModuleSystem) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; return moduleEnv.hasCompilationUnit(this.compoundName, this.enclosingModule.nameForLookup(), checkCUs); } return false; }
public boolean hasCompilationUnit(boolean checkCUs) { if (this.knownTypes != null) { for (ReferenceBinding knownType : this.knownTypes.valueTable) { if (knownType != null && knownType != LookupEnvironment.TheNotFoundType) return true; } } if (this.environment.useModuleSystem) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; return moduleEnv.hasCompilationUnit(this.compoundName, this.enclosingModule.nameForLookup(), checkCUs); } return false; }
/** * Find a type in the given module or any module read by it. * Does not check accessibility / unique visibility, but returns the first observable type found. * @param compoundTypeName name of the sought type * @param module start into the module graph * @return the answer :) */ public NameEnvironmentAnswer findTypeInModules(char[][] compoundTypeName, ModuleBinding module) { char[] nameForLookup = module.nameForLookup(); NameEnvironmentAnswer answer = findType(compoundTypeName, nameForLookup); if (answer != null) return answer; if (LookupStrategy.get(nameForLookup) == LookupStrategy.Named) { for (ModuleBinding required : module.getAllRequiredModules()) { answer = findType(compoundTypeName, required.nameForLookup()); if (answer != null) return answer; } } return null; }
/** * Find a type in the given module or any module read by it. * Does not check accessibility / unique visibility, but returns the first observable type found. * @param compoundTypeName name of the sought type * @param module start into the module graph * @return the answer :) */ public NameEnvironmentAnswer findTypeInModules(char[][] compoundTypeName, ModuleBinding module) { char[] nameForLookup = module.nameForLookup(); NameEnvironmentAnswer answer = findType(compoundTypeName, nameForLookup); if (answer != null) return answer; if (LookupStrategy.get(nameForLookup) == LookupStrategy.Named) { for (ModuleBinding required : module.getAllRequiredModules()) { answer = findType(compoundTypeName, required.nameForLookup()); if (answer != null) return answer; } } return null; }
Function<ModuleBinding,NameEnvironmentAnswer> oracle) if (clientModule != null && clientModule.nameForLookup().length == 0) { NameEnvironmentAnswer answer = oracle.apply(clientModule); if (answer != null)
Function<ModuleBinding,NameEnvironmentAnswer> oracle) if (clientModule != null && clientModule.nameForLookup().length == 0) { NameEnvironmentAnswer answer = oracle.apply(clientModule); if (answer != null)
/** First check for a known type in a split package and otherwise ask the oracle. */ private static NameEnvironmentAnswer fromSplitPackageOrOracle(IModuleAwareNameEnvironment moduleEnv, ModuleBinding module, PackageBinding packageBinding, char[] name) { if (packageBinding instanceof SplitPackageBinding) { // when asking a split package getType0() we may have answered null in case of ambiguity (not knowing the module context). // now check if the module-incarnation of the package has the type: // (needed because the moduleEnv will not answer initial types). ReferenceBinding binding = ((SplitPackageBinding) packageBinding).getType0ForModule(module, name); if (binding != null && binding.isValidBinding()) { if (binding instanceof UnresolvedReferenceBinding) binding = ((UnresolvedReferenceBinding) binding).resolve(module.environment, false); return new NameEnvironmentAnswer(binding, module); } } return moduleEnv.findType(name, packageBinding.compoundName, module.nameForLookup()); } private ModuleBinding getModuleFromAnswer(NameEnvironmentAnswer answer) {
/** First check for a known type in a split package and otherwise ask the oracle. */ private static NameEnvironmentAnswer fromSplitPackageOrOracle(IModuleAwareNameEnvironment moduleEnv, ModuleBinding module, PackageBinding packageBinding, char[] name) { if (packageBinding instanceof SplitPackageBinding) { // when asking a split package getType0() we may have answered null in case of ambiguity (not knowing the module context). // now check if the module-incarnation of the package has the type: // (needed because the moduleEnv will not answer initial types). ReferenceBinding binding = ((SplitPackageBinding) packageBinding).getType0ForModule(module, name); if (binding != null && binding.isValidBinding()) { if (binding instanceof UnresolvedReferenceBinding) binding = ((UnresolvedReferenceBinding) binding).resolve(module.environment, false); return new NameEnvironmentAnswer(binding, module); } } return moduleEnv.findType(name, packageBinding.compoundName, module.nameForLookup()); } private ModuleBinding getModuleFromAnswer(NameEnvironmentAnswer answer) {
if (((INameEnvironmentExtension)this.nameEnvironment).findType(compoundName[i], parent.compoundName, false, this.module.nameForLookup()) != null) { return null;
if (((INameEnvironmentExtension)this.nameEnvironment).findType(compoundName[i], parent.compoundName, false, this.module.nameForLookup()) != null) { return null;
IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.nameEnvironment; answers = askForTypeFromModules(clientModule, clientModule.getAllRequiredModules(), mod -> moduleEnv.findType(compoundName, mod.nameForLookup())); } else { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName);
IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.nameEnvironment; answers = askForTypeFromModules(clientModule, clientModule.getAllRequiredModules(), mod -> moduleEnv.findType(compoundName, mod.nameForLookup())); } else { NameEnvironmentAnswer answer = this.nameEnvironment.findType(compoundName);
if (this.environment.useModuleSystem) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; declaringModuleNames = moduleEnv.getUniqueModulesDeclaringPackage(parentName, name, nameForLookup()); if (declaringModuleNames != null) { if (CharOperation.containsEqual(declaringModuleNames, this.moduleName)) {
if (this.environment.useModuleSystem) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; char[][] declaringModuleNames = moduleEnv.getModulesDeclaringPackage(parentName, name, nameForLookup()); if (declaringModuleNames != null) { if (!this.isUnnamed() && CharOperation.containsEqual(declaringModuleNames, this.moduleName)) {