--- a/src/java.base/share/classes/jdk/internal/module/Modules.java Mon Nov 18 23:41:06 2019 -0500
+++ b/src/java.base/share/classes/jdk/internal/module/Modules.java Tue Nov 19 11:35:29 2019 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
package jdk.internal.module;
+import java.io.PrintStream;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -33,6 +34,7 @@
import java.net.URI;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -40,6 +42,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;
+import jdk.internal.access.JavaLangModuleAccess;
import jdk.internal.loader.BootLoader;
import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.loader.ClassLoaders;
@@ -61,6 +64,7 @@
private Modules() { }
private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
+ private static final JavaLangModuleAccess JLMA = SharedSecrets.getJavaLangModuleAccess();
/**
* Creates a new Module. The module has the given ModuleDescriptor and
@@ -159,6 +163,20 @@
}
/**
+ * Resolves a collection of root modules, with service binding and the empty
+ * Configuration as the parent to create a Configuration for the boot layer.
+ *
+ * This method is intended to be used to create the Configuration for the
+ * boot layer during startup or at a link-time.
+ */
+ public static Configuration newBootLayerConfiguration(ModuleFinder finder,
+ Collection<String> roots,
+ PrintStream traceOutput)
+ {
+ return JLMA.resolveAndBind(finder, roots, traceOutput);
+ }
+
+ /**
* Called by the VM when code in the given Module has been transformed by
* an agent and so may have been instrumented to call into supporting
* classes on the boot class path or application class path.