8186145: tools/launcher/modules/validate/ValidateModulesTest.java fails when launched with -XX:+EnableJVMCI
--validate-modules runs with a boot layer resolving all system modules rather than only java.base Reviewed-by: alanb
This commit is contained in:
parent
d5f19a429a
commit
496b798b66
@ -215,10 +215,10 @@ public final class ModuleBootstrap {
|
||||
|
||||
|
||||
// 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 @@ public final class ModuleBootstrap {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
@ -1296,7 +1296,7 @@ ParseArguments(int *pargc, char ***pargv,
|
||||
} 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 ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user