< prev index next >

modules/jdk.packager/src/main/java/jdk/packager/internal/JLinkBundlerHelper.java

Print this page

        

@@ -373,43 +373,48 @@
 
         // The token for "all redistributable runtime modules".
         public static final String ALL_RUNTIME = "ALL-RUNTIME";
 
         private final Set<String> modules = new HashSet<>();
+        private enum Macros {None, AllModulePath, AllRuntime}
 
         public ModuleHelper(List<Path> paths, Set<String> roots, Set<String> limitMods) {
-            boolean found = false;
+            Set<String> lroots = new HashSet<>();
+            Macros macro = Macros.None;
 
             for (Iterator<String> iterator = roots.iterator(); iterator.hasNext();) {
                 String module = iterator.next();
 
                 switch (module) {
                     case ALL_MODULE_PATH:
                         iterator.remove();
-
-                        if (!found) {
-                            modules.addAll(getModuleNamesFromPath(paths));
-                            found = true;
-                        }
+                        macro = Macros.AllModulePath;
                         break;
                     case ALL_RUNTIME:
                         iterator.remove();
+                        macro = Macros.AllRuntime;
+                        break;
+                    default:
+                        lroots.add(module);
+                }
+            }
 
-                        if (!found) {
-                            Set<String> modules = RedistributableModules.getRedistributableModules(paths, roots, limitMods);
+            switch (macro) {
+                case AllModulePath:
+                    this.modules.addAll(getModuleNamesFromPath(paths));
+                    break;
+                case AllRuntime:
+                    Set<String> m = RedistributableModules.getRedistributableModules(paths);
 
-                            if (modules != null) {
-                                this.modules.addAll(modules);
+                    if (m != null) {
+                        this.modules.addAll(m);
                             }
 
-                            found = true;
-                        }
                         break;
-                    default:
-                        modules.add(module);
-                }
             }
+
+            this.modules.addAll(lroots);
         }
 
         public Set<String> modules() {
             return modules;
         }
< prev index next >