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

changeset 2214
4a2ed1900428
parent 2172
aa91bc6e8480
child 2525
2eb010b6cb22
child 2538
1e39ae45d8ac
     1.1 --- a/src/share/classes/com/sun/tools/jdeps/JdepsTask.java	Tue Dec 03 23:10:23 2013 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/jdeps/JdepsTask.java	Wed Dec 04 15:39:36 2013 -0800
     1.3 @@ -180,6 +180,15 @@
     1.4                  task.options.depth = 0;
     1.5              }
     1.6          },
     1.7 +        new Option(false, "-jdkinternals") {
     1.8 +            void process(JdepsTask task, String opt, String arg) {
     1.9 +                task.options.findJDKInternals = true;
    1.10 +                task.options.verbose = Analyzer.Type.CLASS;
    1.11 +                if (task.options.includePattern == null) {
    1.12 +                    task.options.includePattern = Pattern.compile(".*");
    1.13 +                }
    1.14 +            }
    1.15 +        },
    1.16          new Option(false, "-version") {
    1.17              void process(JdepsTask task, String opt, String arg) {
    1.18                  task.options.version = true;
    1.19 @@ -248,6 +257,11 @@
    1.20                  showHelp();
    1.21                  return EXIT_CMDERR;
    1.22              }
    1.23 +            if (options.findJDKInternals &&
    1.24 +                   (options.regex != null || options.packageNames.size() > 0 || options.showSummary)) {
    1.25 +                showHelp();
    1.26 +                return EXIT_CMDERR;
    1.27 +            }
    1.28              if (options.showSummary && options.verbose != Analyzer.Type.SUMMARY) {
    1.29                  showHelp();
    1.30                  return EXIT_CMDERR;
    1.31 @@ -571,6 +585,7 @@
    1.32          boolean wildcard;
    1.33          boolean apiOnly;
    1.34          boolean showLabel;
    1.35 +        boolean findJDKInternals;
    1.36          String dotOutputDir;
    1.37          String classpath = "";
    1.38          int depth = 1;
    1.39 @@ -681,11 +696,22 @@
    1.40          @Override
    1.41          public void visitDependence(String origin, Archive source,
    1.42                                      String target, Archive archive, Profile profile) {
    1.43 -            if (!origin.equals(pkg)) {
    1.44 -                pkg = origin;
    1.45 -                writer.format("   %s (%s)%n", origin, source.getFileName());
    1.46 +            if (options.findJDKInternals &&
    1.47 +                    !(archive instanceof JDKArchive && profile == null)) {
    1.48 +                // filter dependences other than JDK internal APIs
    1.49 +                return;
    1.50              }
    1.51 -            writer.format("      -> %-50s %s%n", target, getProfileArchiveInfo(archive, profile));
    1.52 +            if (options.verbose == Analyzer.Type.VERBOSE) {
    1.53 +                writer.format("   %-50s -> %-50s %s%n",
    1.54 +                              origin, target, getProfileArchiveInfo(archive, profile));
    1.55 +            } else {
    1.56 +                if (!origin.equals(pkg)) {
    1.57 +                    pkg = origin;
    1.58 +                    writer.format("   %s (%s)%n", origin, source.getFileName());
    1.59 +                }
    1.60 +                writer.format("      -> %-50s %s%n",
    1.61 +                              target, getProfileArchiveInfo(archive, profile));
    1.62 +            }
    1.63          }
    1.64  
    1.65          @Override
    1.66 @@ -717,6 +743,11 @@
    1.67          @Override
    1.68          public void visitDependence(String origin, Archive source,
    1.69                                      String target, Archive archive, Profile profile) {
    1.70 +            if (options.findJDKInternals &&
    1.71 +                    !(archive instanceof JDKArchive && profile == null)) {
    1.72 +                // filter dependences other than JDK internal APIs
    1.73 +                return;
    1.74 +            }
    1.75              // if -P option is specified, package name -> profile will
    1.76              // be shown and filter out multiple same edges.
    1.77              String name = getProfileArchiveInfo(archive, profile);

mercurial