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

changeset 2214
4a2ed1900428
parent 2172
aa91bc6e8480
child 2525
2eb010b6cb22
child 2538
1e39ae45d8ac
equal deleted inserted replaced
2213:1b69023743be 2214:4a2ed1900428
178 new Option(false, "-R", "-recursive") { 178 new Option(false, "-R", "-recursive") {
179 void process(JdepsTask task, String opt, String arg) { 179 void process(JdepsTask task, String opt, String arg) {
180 task.options.depth = 0; 180 task.options.depth = 0;
181 } 181 }
182 }, 182 },
183 new Option(false, "-jdkinternals") {
184 void process(JdepsTask task, String opt, String arg) {
185 task.options.findJDKInternals = true;
186 task.options.verbose = Analyzer.Type.CLASS;
187 if (task.options.includePattern == null) {
188 task.options.includePattern = Pattern.compile(".*");
189 }
190 }
191 },
183 new Option(false, "-version") { 192 new Option(false, "-version") {
184 void process(JdepsTask task, String opt, String arg) { 193 void process(JdepsTask task, String opt, String arg) {
185 task.options.version = true; 194 task.options.version = true;
186 } 195 }
187 }, 196 },
243 showHelp(); 252 showHelp();
244 return EXIT_CMDERR; 253 return EXIT_CMDERR;
245 } 254 }
246 } 255 }
247 if (options.regex != null && options.packageNames.size() > 0) { 256 if (options.regex != null && options.packageNames.size() > 0) {
257 showHelp();
258 return EXIT_CMDERR;
259 }
260 if (options.findJDKInternals &&
261 (options.regex != null || options.packageNames.size() > 0 || options.showSummary)) {
248 showHelp(); 262 showHelp();
249 return EXIT_CMDERR; 263 return EXIT_CMDERR;
250 } 264 }
251 if (options.showSummary && options.verbose != Analyzer.Type.SUMMARY) { 265 if (options.showSummary && options.verbose != Analyzer.Type.SUMMARY) {
252 showHelp(); 266 showHelp();
569 boolean showProfile; 583 boolean showProfile;
570 boolean showSummary; 584 boolean showSummary;
571 boolean wildcard; 585 boolean wildcard;
572 boolean apiOnly; 586 boolean apiOnly;
573 boolean showLabel; 587 boolean showLabel;
588 boolean findJDKInternals;
574 String dotOutputDir; 589 String dotOutputDir;
575 String classpath = ""; 590 String classpath = "";
576 int depth = 1; 591 int depth = 1;
577 Analyzer.Type verbose = Analyzer.Type.PACKAGE; 592 Analyzer.Type verbose = Analyzer.Type.PACKAGE;
578 Set<String> packageNames = new HashSet<>(); 593 Set<String> packageNames = new HashSet<>();
679 694
680 private String pkg = ""; 695 private String pkg = "";
681 @Override 696 @Override
682 public void visitDependence(String origin, Archive source, 697 public void visitDependence(String origin, Archive source,
683 String target, Archive archive, Profile profile) { 698 String target, Archive archive, Profile profile) {
684 if (!origin.equals(pkg)) { 699 if (options.findJDKInternals &&
685 pkg = origin; 700 !(archive instanceof JDKArchive && profile == null)) {
686 writer.format(" %s (%s)%n", origin, source.getFileName()); 701 // filter dependences other than JDK internal APIs
687 } 702 return;
688 writer.format(" -> %-50s %s%n", target, getProfileArchiveInfo(archive, profile)); 703 }
704 if (options.verbose == Analyzer.Type.VERBOSE) {
705 writer.format(" %-50s -> %-50s %s%n",
706 origin, target, getProfileArchiveInfo(archive, profile));
707 } else {
708 if (!origin.equals(pkg)) {
709 pkg = origin;
710 writer.format(" %s (%s)%n", origin, source.getFileName());
711 }
712 writer.format(" -> %-50s %s%n",
713 target, getProfileArchiveInfo(archive, profile));
714 }
689 } 715 }
690 716
691 @Override 717 @Override
692 public void visitArchiveDependence(Archive origin, Archive target, Profile profile) { 718 public void visitArchiveDependence(Archive origin, Archive target, Profile profile) {
693 writer.format("%s -> %s", origin.getPathName(), target.getPathName()); 719 writer.format("%s -> %s", origin.getPathName(), target.getPathName());
715 } 741 }
716 742
717 @Override 743 @Override
718 public void visitDependence(String origin, Archive source, 744 public void visitDependence(String origin, Archive source,
719 String target, Archive archive, Profile profile) { 745 String target, Archive archive, Profile profile) {
746 if (options.findJDKInternals &&
747 !(archive instanceof JDKArchive && profile == null)) {
748 // filter dependences other than JDK internal APIs
749 return;
750 }
720 // if -P option is specified, package name -> profile will 751 // if -P option is specified, package name -> profile will
721 // be shown and filter out multiple same edges. 752 // be shown and filter out multiple same edges.
722 String name = getProfileArchiveInfo(archive, profile); 753 String name = getProfileArchiveInfo(archive, profile);
723 writeEdge(writer, new Edge(origin, target, getProfileArchiveInfo(archive, profile))); 754 writeEdge(writer, new Edge(origin, target, getProfileArchiveInfo(archive, profile)));
724 } 755 }

mercurial