< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DepsAnalyzer.java

Print this page

        

*** 26,35 **** --- 26,36 ---- package com.sun.tools.jdeps; import com.sun.tools.classfile.Dependency.Location; import java.io.IOException; import java.util.ArrayList; + import java.util.Collection; import java.util.Deque; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Optional;
*** 89,99 **** // if -include pattern is specified, add the matching archives on // classpath to the root archives if (filter.hasIncludePattern() || filter.hasTargetFilter()) { configuration.getModules().values().stream() ! .filter(source -> filter.include(source) && filter.matches(source)) .forEach(this.rootArchives::add); } // class path archives configuration.classPathArchives().stream() --- 90,100 ---- // if -include pattern is specified, add the matching archives on // classpath to the root archives if (filter.hasIncludePattern() || filter.hasTargetFilter()) { configuration.getModules().values().stream() ! .filter(source -> include(source) && filter.matches(source)) .forEach(this.rootArchives::add); } // class path archives configuration.classPathArchives().stream()
*** 159,176 **** * If --require is set, they should be excluded. */ Set<Archive> archives() { if (filter.requiresFilter().isEmpty()) { return archives.stream() ! .filter(filter::include) .filter(Archive::hasDependences) .collect(Collectors.toSet()); } else { // use the archives that have dependences and not specified in --require return archives.stream() ! .filter(filter::include) ! .filter(source -> !filter.requiresFilter().contains(source)) .filter(source -> source.getDependencies() .map(finder::locationToArchive) .anyMatch(a -> a != source)) .collect(Collectors.toSet()); --- 160,177 ---- * If --require is set, they should be excluded. */ Set<Archive> archives() { if (filter.requiresFilter().isEmpty()) { return archives.stream() ! .filter(this::include) .filter(Archive::hasDependences) .collect(Collectors.toSet()); } else { // use the archives that have dependences and not specified in --require return archives.stream() ! .filter(this::include) ! .filter(source -> !filter.requiresFilter().contains(source.getName())) .filter(source -> source.getDependencies() .map(finder::locationToArchive) .anyMatch(a -> a != source)) .collect(Collectors.toSet());
*** 195,205 **** private Set<Archive> unresolvedArchives(Stream<Location> locations) { return locations.filter(l -> !finder.isParsed(l)) .distinct() .map(configuration::findClass) .flatMap(Optional::stream) - .filter(filter::include) .collect(toSet()); } /* * Recursively analyzes entire module/archives. --- 196,205 ----
*** 236,246 **** while ((target = unresolved.poll()) != null) { if (finder.isParsed(target)) continue; Archive archive = configuration.findClass(target).orElse(null); ! if (archive != null && filter.include(archive)) { archives.add(archive); String name = target.getName(); Set<Location> targets = apiOnly ? finder.parseExportedAPIs(archive, name) --- 236,246 ---- while ((target = unresolved.poll()) != null) { if (finder.isParsed(target)) continue; Archive archive = configuration.findClass(target).orElse(null); ! if (archive != null) { archives.add(archive); String name = target.getName(); Set<Location> targets = apiOnly ? finder.parseExportedAPIs(archive, name)
*** 255,264 **** --- 255,279 ---- unresolved = deque; deque = new ConcurrentLinkedDeque<>(); } while (!unresolved.isEmpty() && depth-- > 0); } + /* + * Tests if the given archive is requested for analysis. + * It includes the root modules specified in --module, --add-modules + * or modules specified on the command line + * + * This filters system module by default unless they are explicitly + * requested. + */ + public boolean include(Archive source) { + Module module = source.getModule(); + // skip system module by default + return !module.isSystem() + || configuration.rootModules().contains(source); + } + // ----- for testing purpose ----- public static enum Info { REQUIRES, REQUIRES_TRANSITIVE,
< prev index next >