changeset 17718:162c0a6e1fe3

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
author mchung
date Fri, 25 Aug 2017 10:52:17 -0700
parents 603393a94dd7
children 965d4dde0086 daed9a0332d3
files src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java src/java.base/share/native/libjli/java.c
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Fri Aug 25 10:43:12 2017 -0700
+++ b/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/src/java.base/share/native/libjli/java.c	Fri Aug 25 10:43:12 2017 -0700
+++ b/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 ||