< prev index next >

src/java.base/share/classes/java/lang/ModuleLayer.java

Print this page
8200125: Fix some classloader/module typos
Reviewed-by: alanb


 135  *     Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("myapp"));
 136  *
 137  *     ClassLoader scl = ClassLoader.getSystemClassLoader();
 138  *
 139  *     ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
 140  *
 141  *     Class<?> c = layer.findLoader("myapp").loadClass("app.Main");
 142  * }</pre>
 143  *
 144  * @since 9
 145  * @spec JPMS
 146  * @see Module#getLayer()
 147  */
 148 
 149 public final class ModuleLayer {
 150 
 151     // the empty layer
 152     private static final ModuleLayer EMPTY_LAYER
 153         = new ModuleLayer(Configuration.empty(), List.of(), null);
 154 
 155     // the configuration from which this ;ayer was created
 156     private final Configuration cf;
 157 
 158     // parent layers, empty in the case of the empty layer
 159     private final List<ModuleLayer> parents;
 160 
 161     // maps module name to jlr.Module
 162     private final Map<String, Module> nameToModule;
 163 
 164     /**
 165      * Creates a new module layer from the modules in the given configuration.
 166      */
 167     private ModuleLayer(Configuration cf,
 168                         List<ModuleLayer> parents,
 169                         Function<String, ClassLoader> clf)
 170     {
 171         this.cf = cf;
 172         this.parents = parents; // no need to do defensive copy
 173 
 174         Map<String, Module> map;
 175         if (parents.isEmpty()) {




 135  *     Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("myapp"));
 136  *
 137  *     ClassLoader scl = ClassLoader.getSystemClassLoader();
 138  *
 139  *     ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
 140  *
 141  *     Class<?> c = layer.findLoader("myapp").loadClass("app.Main");
 142  * }</pre>
 143  *
 144  * @since 9
 145  * @spec JPMS
 146  * @see Module#getLayer()
 147  */
 148 
 149 public final class ModuleLayer {
 150 
 151     // the empty layer
 152     private static final ModuleLayer EMPTY_LAYER
 153         = new ModuleLayer(Configuration.empty(), List.of(), null);
 154 
 155     // the configuration from which this layer was created
 156     private final Configuration cf;
 157 
 158     // parent layers, empty in the case of the empty layer
 159     private final List<ModuleLayer> parents;
 160 
 161     // maps module name to jlr.Module
 162     private final Map<String, Module> nameToModule;
 163 
 164     /**
 165      * Creates a new module layer from the modules in the given configuration.
 166      */
 167     private ModuleLayer(Configuration cf,
 168                         List<ModuleLayer> parents,
 169                         Function<String, ClassLoader> clf)
 170     {
 171         this.cf = cf;
 172         this.parents = parents; // no need to do defensive copy
 173 
 174         Map<String, Module> map;
 175         if (parents.isEmpty()) {


< prev index next >