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

Print this page

        

@@ -178,10 +178,19 @@
         new Option(false, "-R", "-recursive") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.depth = 0;
             }
         },
+        new Option(false, "-jdkinternals") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.findJDKInternals = true;
+                task.options.verbose = Analyzer.Type.CLASS;
+                if (task.options.includePattern == null) {
+                    task.options.includePattern = Pattern.compile(".*");
+                }
+            }
+        },
         new Option(false, "-version") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.version = true;
             }
         },

@@ -246,10 +255,15 @@
             }
             if (options.regex != null && options.packageNames.size() > 0) {
                 showHelp();
                 return EXIT_CMDERR;
             }
+            if (options.findJDKInternals &&
+                   (options.regex != null || options.packageNames.size() > 0 || options.showSummary)) {
+                showHelp();
+                return EXIT_CMDERR;
+            }
             if (options.showSummary && options.verbose != Analyzer.Type.SUMMARY) {
                 showHelp();
                 return EXIT_CMDERR;
             }
             boolean ok = run();

@@ -569,10 +583,11 @@
         boolean showProfile;
         boolean showSummary;
         boolean wildcard;
         boolean apiOnly;
         boolean showLabel;
+        boolean findJDKInternals;
         String dotOutputDir;
         String classpath = "";
         int depth = 1;
         Analyzer.Type verbose = Analyzer.Type.PACKAGE;
         Set<String> packageNames = new HashSet<>();

@@ -679,10 +694,15 @@
 
         private String pkg = "";
         @Override
         public void visitDependence(String origin, Archive source,
                                     String target, Archive archive, Profile profile) {
+            if (options.findJDKInternals &&
+                    !(archive instanceof JDKArchive && profile == null)) {
+                // filter dependences other than JDK internal APIs
+                return;
+            }
             if (!origin.equals(pkg)) {
                 pkg = origin;
                 writer.format("   %s (%s)%n", origin, source.getFileName());
             }
             writer.format("      -> %-50s %s%n", target, getProfileArchiveInfo(archive, profile));

@@ -715,10 +735,15 @@
         }
 
         @Override
         public void visitDependence(String origin, Archive source,
                                     String target, Archive archive, Profile profile) {
+            if (options.findJDKInternals &&
+                    !(archive instanceof JDKArchive && profile == null)) {
+                // filter dependences other than JDK internal APIs
+                return;
+            }
             // if -P option is specified, package name -> profile will
             // be shown and filter out multiple same edges.
             String name = getProfileArchiveInfo(archive, profile);
             writeEdge(writer, new Edge(origin, target, getProfileArchiveInfo(archive, profile)));
         }