--- old/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java 2016-08-07 17:45:15.000000000 -0700 +++ new/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java 2016-08-07 17:45:15.000000000 -0700 @@ -56,8 +56,8 @@ * The {@link #boot() boot} method is called early in the startup to initialize * the module system. In summary, the boot method creates a Configuration by * resolving a set of module names specified via the launcher (or equivalent) - * -m and -addmods options. The modules are located on a module path that is - * constructed from the upgrade module path, system modules, and application + * -m and --add-modules options. The modules are located on a module path that + * is constructed from the upgrade module path, system modules, and application * module path. The Configuration is instantiated as the boot Layer with each * module in the the configuration defined to one of the built-in class loaders. */ @@ -127,16 +127,16 @@ long t2 = System.nanoTime(); - // -upgrademodulepath option specified to launcher + // --upgrade-module-path option specified to launcher ModuleFinder upgradeModulePath - = createModulePathFinder("jdk.upgrade.module.path"); + = createModulePathFinder("jdk.module.upgrade.path"); if (upgradeModulePath != null) systemModules = ModuleFinder.compose(upgradeModulePath, systemModules); - // -modulepath option specified to the launcher + // --module-path option specified to the launcher ModuleFinder appModulePath = createModulePathFinder("jdk.module.path"); - // The module finder: [-upgrademodulepath] system [-modulepath] + // The module finder: [--upgrade-module-path] system [--module-path] ModuleFinder finder = systemModules; if (appModulePath != null) finder = ModuleFinder.compose(finder, appModulePath); @@ -149,11 +149,11 @@ if (mainModule != null) roots.add(mainModule); - // additional module(s) specified by -addmods + // additional module(s) specified by --add-modules boolean addAllDefaultModules = false; boolean addAllSystemModules = false; boolean addAllApplicationModules = false; - String propValue = System.getProperty("jdk.launcher.addmods"); + String propValue = getAndRemoveProperty("jdk.module.addmods"); if (propValue != null) { for (String mod: propValue.split(",")) { switch (mod) { @@ -172,8 +172,8 @@ } } - // -limitmods - propValue = System.getProperty("jdk.launcher.limitmods"); + // --limit-modules + propValue = getAndRemoveProperty("jdk.module.limitmods"); if (propValue != null) { Set mods = new HashSet<>(); for (String mod: propValue.split(",")) { @@ -216,7 +216,7 @@ } } - // If `-addmods ALL-SYSTEM` is specified then all observable system + // If `--add-modules ALL-SYSTEM` is specified then all observable system // modules will be resolved. if (addAllSystemModules) { ModuleFinder f = finder; // observable modules @@ -228,9 +228,9 @@ .forEach(mn -> roots.add(mn)); } - // If `-addmods ALL-MODULE-PATH` is specified then all observable + // If `--add-modules ALL-MODULE-PATH` is specified then all observable // modules on the application module path will be resolved. - if (appModulePath != null && addAllApplicationModules) { + if (appModulePath != null && addAllApplicationModules) { ModuleFinder f = finder; // observable modules appModulePath.findAll() .stream() @@ -250,7 +250,7 @@ if (baseUri.getScheme().equals("jrt") // toLowerCase not needed here && (upgradeModulePath == null) && (appModulePath == null) - && (System.getProperty("jdk.launcher.patch.0") == null)) { + && (!ModulePatcher.isBootLayerPatched())) { needPostResolutionChecks = false; } @@ -317,7 +317,7 @@ PerfCounters.loadModulesTime.addElapsedTimeFrom(t5); - // -XaddReads and -XaddExports + // --add-reads and --add-exports addExtraReads(bootLayer); addExtraExports(bootLayer); @@ -394,13 +394,13 @@ /** - * Process the -XaddReads options to add any additional read edges that + * Process the --add-reads options to add any additional read edges that * are specified on the command-line. */ private static void addExtraReads(Layer bootLayer) { // decode the command line options - Map> map = decode("jdk.launcher.addreads."); + Map> map = decode("jdk.module.addreads."); for (Map.Entry> e : map.entrySet()) { @@ -431,13 +431,13 @@ /** - * Process the -XaddExports options to add any additional read edges that + * Process the --add-exports options to add any additional read edges that * are specified on the command-line. */ private static void addExtraExports(Layer bootLayer) { // decode the command line options - Map> map = decode("jdk.launcher.addexports."); + Map> map = decode("jdk.module.addexports."); for (Map.Entry> e : map.entrySet()) { @@ -483,13 +483,14 @@ /** - * Decodes the values of -XaddReads or -XaddExports options + * Decodes the values of --add-reads or --add-exports options * * The format of the options is: $KEY=$MODULE(,$MODULE)* */ private static Map> decode(String prefix) { int index = 0; - String value = System.getProperty(prefix + index); + // the system property is removed after decoding + String value = getAndRemoveProperty(prefix + index); if (value == null) return Collections.emptyMap(); @@ -522,12 +523,18 @@ } index++; - value = System.getProperty(prefix + index); + value = getAndRemoveProperty(prefix + index); } return map; } + /** + * Gets and remove the named system property + */ + private static String getAndRemoveProperty(String key) { + return (String)System.getProperties().remove(key); + } /** * Throws a RuntimeException with the given message