< prev index next >

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

Print this page

        

*** 423,441 **** void process(JdepsTask task, String opt, String arg) throws BadArgs { task.options.showProfile = true; } }, ! new Option(false, "-R", "-recursive") { ! void process(JdepsTask task, String opt, String arg) { ! task.options.depth = 0; // turn off filtering task.options.filterSameArchive = false; task.options.filterSamePackage = false; } }, ! new Option(false, "-I", "--inverse") { void process(JdepsTask task, String opt, String arg) { task.options.inverse = true; // equivalent to the inverse of compile-time view analysis task.options.compileTimeView = true; --- 423,445 ---- void process(JdepsTask task, String opt, String arg) throws BadArgs { task.options.showProfile = true; } }, ! new Option(false, "-R", "-recursive", "--recursive") { ! void process(JdepsTask task, String opt, String arg) throws BadArgs { ! task.options.recursive = Options.RECURSIVE; // turn off filtering task.options.filterSameArchive = false; task.options.filterSamePackage = false; } }, ! new Option(false, "--no-recursive") { ! void process(JdepsTask task, String opt, String arg) throws BadArgs { ! task.options.recursive = Options.NO_RECURSIVE; ! } ! }, new Option(false, "-I", "--inverse") { void process(JdepsTask task, String opt, String arg) { task.options.inverse = true; // equivalent to the inverse of compile-time view analysis task.options.compileTimeView = true;
*** 445,457 **** }, new Option(false, "--compile-time") { void process(JdepsTask task, String opt, String arg) { task.options.compileTimeView = true; task.options.filterSamePackage = true; task.options.filterSameArchive = true; - task.options.depth = 0; } }, new HiddenOption(false, "-fullversion") { void process(JdepsTask task, String opt, String arg) { --- 449,461 ---- }, new Option(false, "--compile-time") { void process(JdepsTask task, String opt, String arg) { task.options.compileTimeView = true; + task.options.recursive = Options.RECURSIVE; task.options.filterSamePackage = true; task.options.filterSameArchive = true; } }, new HiddenOption(false, "-fullversion") { void process(JdepsTask task, String opt, String arg) {
*** 619,633 **** } return new GenModuleInfo(dir, openModule); } private ListModuleDeps listModuleDeps(CommandOption option) throws BadArgs { // no need to record the dependences on the same archive or same package options.filterSameArchive = true; options.filterSamePackage = true; - // do transitive dependence analysis - options.depth = 0; switch (option) { case LIST_DEPS: return new ListModuleDeps(option, true, false); case LIST_REDUCED_DEPS: return new ListModuleDeps(option, true, true); --- 623,639 ---- } return new GenModuleInfo(dir, openModule); } private ListModuleDeps listModuleDeps(CommandOption option) throws BadArgs { + // do transitive dependence analysis unless --no-recursive is set + if (options.recursive != Options.NO_RECURSIVE) { + options.recursive = Options.RECURSIVE; + } // no need to record the dependences on the same archive or same package options.filterSameArchive = true; options.filterSamePackage = true; switch (option) { case LIST_DEPS: return new ListModuleDeps(option, true, false); case LIST_REDUCED_DEPS: return new ListModuleDeps(option, true, true);
*** 757,767 **** dependencyFilter(config), writer, type, options.apiOnly); ! boolean ok = analyzer.run(options.compileTimeView, options.depth); // print skipped entries, if any if (!options.nowarning) { analyzer.archives() .forEach(archive -> archive.reader() --- 763,773 ---- dependencyFilter(config), writer, type, options.apiOnly); ! boolean ok = analyzer.run(options.compileTimeView, options.depth()); // print skipped entries, if any if (!options.nowarning) { analyzer.archives() .forEach(archive -> archive.reader()
*** 810,821 **** InverseAnalyzeDeps() { } @Override boolean checkOptions() { ! if (options.depth != 1) { ! reportError("err.invalid.options", "-R", "--inverse"); return false; } if (options.numFilters() == 0) { reportError("err.filter.not.specified"); --- 816,827 ---- InverseAnalyzeDeps() { } @Override boolean checkOptions() { ! if (options.recursive != -1 || options.depth != -1) { ! reportError("err.invalid.options", "--recursive and --no-recursive", "--inverse"); return false; } if (options.numFilters() == 0) { reportError("err.filter.not.specified");
*** 1031,1041 **** dependencyFilter(config), jdkinternals, reduced, log, separator); ! boolean ok = analyzer.run(options.depth, options.ignoreMissingDeps); if (!ok) { reportError("err.cant.list.module.deps"); log.println(); analyzer.visitMissingDeps(new SimpleDepVisitor()); } --- 1037,1047 ---- dependencyFilter(config), jdkinternals, reduced, log, separator); ! boolean ok = analyzer.run(options.depth(), options.ignoreMissingDeps); if (!ok) { reportError("err.cant.list.module.deps"); log.println(); analyzer.visitMissingDeps(new SimpleDepVisitor()); }
*** 1203,1212 **** --- 1209,1220 ---- throw new InternalError("Missing message: " + key); } } private static class Options { + static final int NO_RECURSIVE = 0; + static final int RECURSIVE = 1; boolean help; boolean version; boolean fullVersion; boolean showProfile; boolean showModule = true;
*** 1221,1231 **** // default filter references from same package boolean filterSamePackage = true; boolean filterSameArchive = false; Pattern filterRegex; String classpath; ! int depth = 1; Set<String> requires = new HashSet<>(); Set<String> packageNames = new HashSet<>(); Pattern regex; // apply to the dependences Pattern includePattern; boolean inverse = false; --- 1229,1240 ---- // default filter references from same package boolean filterSamePackage = true; boolean filterSameArchive = false; Pattern filterRegex; String classpath; ! int recursive = -1; // 0: --no-recursive, 1: --recursive ! int depth = -1; Set<String> requires = new HashSet<>(); Set<String> packageNames = new HashSet<>(); Pattern regex; // apply to the dependences Pattern includePattern; boolean inverse = false;
*** 1250,1259 **** --- 1259,1281 ---- if (requires.size() > 0) count++; if (regex != null) count++; if (packageNames.size() > 0) count++; return count; } + + int depth() { + // ignore -depth if --no-recursive is set + if (recursive == NO_RECURSIVE) + return 1; + + // depth == 0 if recursive + if (recursive == RECURSIVE && depth == -1) + return 0; + + // default depth is 1 unless specified via -depth option + return depth == -1 ? 1 : depth; + } } private static class ResourceBundleHelper { static final String LS = System.lineSeparator(); static final ResourceBundle versionRB;
< prev index next >