jdk/test/java/lang/Class/forName/modules/TestLayer.java
changeset 44545 83b611b88ac8
parent 43712 5dfd0950317c
equal deleted inserted replaced
44480:2c33418a6d57 44545:83b611b88ac8
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 import java.lang.module.Configuration;
    24 import java.lang.module.Configuration;
    25 import java.lang.module.ModuleFinder;
    25 import java.lang.module.ModuleFinder;
    26 import java.lang.reflect.Layer;
       
    27 import java.lang.reflect.Method;
    26 import java.lang.reflect.Method;
    28 import java.lang.reflect.Module;
       
    29 import java.net.URL;
    27 import java.net.URL;
    30 import java.net.URLClassLoader;
    28 import java.net.URLClassLoader;
    31 import java.nio.file.Path;
    29 import java.nio.file.Path;
    32 import java.nio.file.Paths;
    30 import java.nio.file.Paths;
    33 import java.util.Set;
    31 import java.util.Set;
    43             System.setSecurityManager(null);
    41             System.setSecurityManager(null);
    44         }
    42         }
    45 
    43 
    46         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
    44         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
    47 
    45 
    48         Configuration parent = Layer.boot().configuration();
    46         Configuration parent = ModuleLayer.boot().configuration();
    49         Configuration cf = parent.resolveAndBind(ModuleFinder.of(),
    47         Configuration cf = parent.resolveAndBind(ModuleFinder.of(),
    50                                                  finder,
    48                                                  finder,
    51                                                  modules);
    49                                                  modules);
    52 
    50 
    53         ClassLoader scl = ClassLoader.getSystemClassLoader();
    51         ClassLoader scl = ClassLoader.getSystemClassLoader();
    54         Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl);
    52         ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
    55 
    53 
    56         Module m1 = layer.findModule("m1").get();
    54         Module m1 = layer.findModule("m1").get();
    57         Module m2 = layer.findModule("m2").get();
    55         Module m2 = layer.findModule("m2").get();
    58 
    56 
    59         if (sm != null) {
    57         if (sm != null) {