< prev index next >
src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
Print this page
@@ -151,13 +151,11 @@
// additional module(s) specified by --add-modules
boolean addAllDefaultModules = false;
boolean addAllSystemModules = false;
boolean addAllApplicationModules = false;
- String propValue = getAndRemoveProperty("jdk.module.addmods");
- if (propValue != null) {
- for (String mod: propValue.split(",")) {
+ for (String mod: getExtraAddModules()) {
switch (mod) {
case ALL_DEFAULT:
addAllDefaultModules = true;
break;
case ALL_SYSTEM:
@@ -168,14 +166,13 @@
break;
default :
roots.add(mod);
}
}
- }
// --limit-modules
- propValue = getAndRemoveProperty("jdk.module.limitmods");
+ String propValue = getAndRemoveProperty("jdk.module.limitmods");
if (propValue != null) {
Set<String> mods = new HashSet<>();
for (String mod: propValue.split(",")) {
mods.add(mod);
}
@@ -390,10 +387,36 @@
}
return ModuleFinder.of(paths);
}
}
+ /**
+ * Returns the set of module names specified via --add-modules options
+ * on the command line
+ */
+ private static Set<String> getExtraAddModules() {
+ String prefix = "jdk.module.addmods.";
+ int index = 0;
+
+ // the system property is removed after decoding
+ String value = getAndRemoveProperty(prefix + index);
+ if (value == null) {
+ return Collections.emptySet();
+ }
+
+ Set<String> modules = new HashSet<>();
+ while (value != null) {
+ for (String s : value.split(",")) {
+ if (s.length() > 0) modules.add(s);
+ }
+
+ index++;
+ value = getAndRemoveProperty(prefix + index);
+ }
+
+ return modules;
+ }
/**
* Process the --add-reads options to add any additional read edges that
* are specified on the command-line.
*/
< prev index next >