ClasspathDirectory classpathDirectory = (ClasspathDirectory) this.classpaths[i]; LookupStrategy strategy = LookupStrategy.get(moduleName); if (!strategy.matchesWithName(classpathDirectory, loc -> loc.getModule() != null, loc -> loc.servesModule(moduleName))) {
public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes, char[] moduleName) { checkCanceled(); NameEnvironmentAnswer answer = super.findType(typeName, packageName, moduleName); if (answer == null && searchWithSecondaryTypes) { NameEnvironmentAnswer suggestedAnswer = null; String qualifiedPackageName = new String(CharOperation.concatWith(packageName, '/')); String qualifiedTypeName = new String(CharOperation.concatWith(packageName, typeName, '/')); String qualifiedBinaryFileName = qualifiedTypeName + SUFFIX_STRING_class; for (int i = 0, length = this.classpaths.length; i < length; i++) { if (!(this.classpaths[i] instanceof ClasspathDirectory)) continue; ClasspathDirectory classpathDirectory = (ClasspathDirectory) this.classpaths[i]; LookupStrategy strategy = LookupStrategy.get(moduleName); if (!strategy.matchesWithName(classpathDirectory, loc -> loc.getModule() != null, loc -> loc.servesModule(moduleName))) { continue; } answer = classpathDirectory.findSecondaryInClass(typeName, qualifiedPackageName, qualifiedBinaryFileName); if (answer != null) { if (!answer.ignoreIfBetter()) { if (answer.isBetter(suggestedAnswer)) return answer; } else if (answer.isBetter(suggestedAnswer)) // remember suggestion and keep looking suggestedAnswer = answer; } } } return answer; }
/** * Test whether the given element matches this lookup strategy. * @param elem location being tests * @param isNamed predicate to determine if 'elem' represents a named module * @return true iff the given element matches this lookup strategy. */ public <T> boolean matches(T elem, Predicate<T> isNamed) { return matchesWithName(elem, isNamed, t -> true); }
/** * Test whether the given element matches this lookup strategy. * @param elem location being tests * @param isNamed predicate to determine if 'elem' represents a named module * @return true iff the given element matches this lookup strategy. */ public <T> boolean matches(T elem, Predicate<T> isNamed) { return matchesWithName(elem, isNamed, t -> true); }