jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java
changeset 44545 83b611b88ac8
parent 43712 5dfd0950317c
child 45393 de4e1efc8eec
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.Proxy;
    26 import java.lang.reflect.Proxy;
    28 import java.nio.file.Path;
    27 import java.nio.file.Path;
    29 import java.nio.file.Paths;
    28 import java.nio.file.Paths;
    30 import java.util.Arrays;
    29 import java.util.Arrays;
    31 import java.util.List;
    30 import java.util.List;
    86      * Test unnamed module has no access to other proxy interface
    85      * Test unnamed module has no access to other proxy interface
    87      */
    86      */
    88     @Test
    87     @Test
    89     public void testNoReadAccess() throws Exception {
    88     public void testNoReadAccess() throws Exception {
    90         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
    89         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
    91         Layer bootLayer = Layer.boot();
    90         ModuleLayer bootLayer = ModuleLayer.boot();
    92         Configuration cf = bootLayer
    91         Configuration cf = bootLayer
    93                 .configuration()
    92                 .configuration()
    94                 .resolveAndBind(ModuleFinder.of(), finder, modules);
    93                 .resolveAndBind(ModuleFinder.of(), finder, modules);
    95         ClassLoader parentLoader = this.getClass().getClassLoader();
    94         ClassLoader parentLoader = this.getClass().getClassLoader();
    96         Layer layer = bootLayer.defineModulesWithOneLoader(cf, parentLoader);
    95         ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, parentLoader);
    97 
    96 
    98         ClassLoader loader = layer.findLoader("m1");
    97         ClassLoader loader = layer.findLoader("m1");
    99         Class<?>[] interfaces = new Class<?>[] {
    98         Class<?>[] interfaces = new Class<?>[] {
   100                 Class.forName("p.one.I", false, loader),
    99                 Class.forName("p.one.I", false, loader),
   101                 Class.forName("q.NP", false, loader)     // non-public interface in unnamed module
   100                 Class.forName("q.NP", false, loader)     // non-public interface in unnamed module