< prev index next >

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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -538,11 +538,11 @@
             log.flush();
         }
     }
 
     boolean run() throws IOException {
-        try (JdepsConfiguration config = buildConfig(command.allModules())) {
+        try (JdepsConfiguration config = buildConfig()) {
             if (!options.nowarning) {
                 // detect split packages
                 config.splitPackages().entrySet()
                       .stream()
                       .sorted(Map.Entry.comparingByKey())

@@ -551,30 +551,26 @@
                                             e.getValue().stream().collect(joining(" "))));
             }
 
             // check if any module specified in --add-modules, --require, and -m is missing
             options.addmods.stream()
-                .filter(mn -> !config.isValidToken(mn))
+                .filter(mn -> !JdepsConfiguration.isToken(mn))
                 .forEach(mn -> config.findModule(mn).orElseThrow(() ->
                     new UncheckedBadArgs(new BadArgs("err.module.not.found", mn))));
 
             return command.run(config);
         }
     }
 
-    private JdepsConfiguration buildConfig(boolean allModules) throws IOException {
+    private JdepsConfiguration buildConfig() throws IOException {
         JdepsConfiguration.Builder builder =
             new JdepsConfiguration.Builder(options.systemModulePath);
 
         builder.upgradeModulePath(options.upgradeModulePath)
                .appModulePath(options.modulePath)
-               .addmods(options.addmods);
-
-        if (allModules) {
-            // check all system modules in the image
-            builder.allModules();
-        }
+               .addmods(options.addmods)
+               .addmods(command.addModules());
 
         if (options.classpath != null)
             builder.addClassPath(options.classpath);
 
         if (options.multiRelease != null)

@@ -653,12 +649,12 @@
          *
          * When a named module is analyzed, it will analyze the dependences
          * only.  The method should be overridden when this command should
          * analyze all modules instead.
          */
-        boolean allModules() {
-            return false;
+        Set<String> addModules() {
+            return Set.of();
         }
 
         @Override
         public String toString() {
             return option.toString();

@@ -869,12 +865,12 @@
         /*
          * Returns true if --require is specified so that all modules are
          * analyzed to find all modules that depend on the modules specified in the
          * --require option directly and indirectly
          */
-        public boolean allModules() {
-            return options.requires.size() > 0;
+        Set<String> addModules() {
+            return options.requires.size() > 0 ? Set.of("ALL-SYSTEM") : Set.of();
         }
     }
 
 
     class GenModuleInfo extends Command {

@@ -973,12 +969,12 @@
         }
 
         /*
          * Returns true to analyze all modules
          */
-        public boolean allModules() {
-            return true;
+        Set<String> addModules() {
+            return Set.of("ALL-SYSTEM", "ALL-MODULE-PATH");
         }
     }
 
     class ListModuleDeps extends Command {
         final boolean jdkinternals;
< prev index next >