8186145: tools/launcher/modules/validate/ValidateModulesTest.java fails when launched with -XX:+EnableJVMCI
authormchung
Fri, 25 Aug 2017 10:52:17 -0700
changeset 47010 d8dd5c878ce5
parent 47009 ed227a8f92fb
child 47011 9eba50796e72
child 47118 10283559cc3c
8186145: tools/launcher/modules/validate/ValidateModulesTest.java fails when launched with -XX:+EnableJVMCI Summary: --validate-modules runs with a boot layer resolving all system modules rather than only java.base Reviewed-by: alanb
jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
jdk/src/java.base/share/native/libjli/java.c
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Fri Aug 25 10:43:12 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Fri Aug 25 10:52:17 2017 -0700
@@ -215,10 +215,10 @@
 
 
         // Step 2a: If --validate-modules is specified then the VM needs to
-        // start with only java.base, all other options are ignored.
+        // start with only system modules, all other options are ignored.
 
-        if (getAndRemoveProperty("jdk.module.minimumBoot") != null) {
-            return createMinimalBootLayer();
+        if (getAndRemoveProperty("jdk.module.validation") != null) {
+            return createBootLayerForValidation();
         }
 
 
@@ -421,12 +421,19 @@
     }
 
     /**
-     * Create a "minimal" boot module layer that only contains java.base.
+     * Create a boot module layer for validation that resolves all
+     * system modules.
      */
-    private static ModuleLayer createMinimalBootLayer() {
+    private static ModuleLayer createBootLayerForValidation() {
+        Set<String> allSystem = ModuleFinder.ofSystem().findAll()
+            .stream()
+            .map(ModuleReference::descriptor)
+            .map(ModuleDescriptor::name)
+            .collect(Collectors.toSet());
+
         Configuration cf = SharedSecrets.getJavaLangModuleAccess()
             .resolveAndBind(ModuleFinder.ofSystem(),
-                            Set.of(JAVA_BASE),
+                            allSystem,
                             null);
 
         Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
--- a/jdk/src/java.base/share/native/libjli/java.c	Fri Aug 25 10:43:12 2017 -0700
+++ b/jdk/src/java.base/share/native/libjli/java.c	Fri Aug 25 10:52:17 2017 -0700
@@ -1296,7 +1296,7 @@
         } else if (JLI_StrCmp(arg, "--show-resolved-modules") == 0) {
             showResolvedModules = JNI_TRUE;
         } else if (JLI_StrCmp(arg, "--validate-modules") == 0) {
-            AddOption("-Djdk.module.minimumBoot=true", NULL);
+            AddOption("-Djdk.module.validation=true", NULL);
             validateModules = JNI_TRUE;
         } else if (JLI_StrCmp(arg, "--describe-module") == 0 ||
                    JLI_StrCCmp(arg, "--describe-module=") == 0 ||