hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java
changeset 46404 ae62ba99a1a7
parent 44520 0553e129e0ec
equal deleted inserted replaced
46403:f2b91b928476 46404:ae62ba99a1a7
    54         ClassLoader this_cldr = JVMAddModuleExportsToAll.class.getClassLoader();
    54         ClassLoader this_cldr = JVMAddModuleExportsToAll.class.getClassLoader();
    55 
    55 
    56         // Define a module for p3.
    56         // Define a module for p3.
    57         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
    57         m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
    58         assertNotNull(m1x, "Module should not be null");
    58         assertNotNull(m1x, "Module should not be null");
    59         ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
    59         ModuleHelper.DefineModule(m1x, false, "9.0", "m1x/there", new String[] { "p3" });
    60         ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
    60         ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
    61 
    61 
    62         // Define a module for p2.
    62         // Define a module for p2.
    63         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
    63         m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
    64         assertNotNull(m2x, "Module should not be null");
    64         assertNotNull(m2x, "Module should not be null");
    65         ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
    65         ModuleHelper.DefineModule(m2x, false, "9.0", "m2x/there", new String[] { "p2" });
    66         ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
    66         ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
    67 
    67 
    68         try {
    68         try {
    69             ModuleHelper.AddModuleExportsToAll((Module)null, "p2");
    69             ModuleHelper.AddModuleExportsToAll((Module)null, "p2");
    70             throw new RuntimeException("Failed to get the expected NPE for null module");
    70             throw new RuntimeException("Failed to get the expected NPE for null module");
   102 
   102 
   103         // Export package p2 in m2x unqualifiedly. Then, do a qualified export
   103         // Export package p2 in m2x unqualifiedly. Then, do a qualified export
   104         // of p2 in m2x to m3x.  This should not affect the unqualified export.
   104         // of p2 in m2x to m3x.  This should not affect the unqualified export.
   105         m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p4" });
   105         m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p4" });
   106         assertNotNull(m3x, "Module m3x should not be null");
   106         assertNotNull(m3x, "Module m3x should not be null");
   107         ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p4" });
   107         ModuleHelper.DefineModule(m3x, false, "9.0", "m3x/there", new String[] { "p4" });
   108         ModuleHelper.AddModuleExportsToAll(m2x, "p2");
   108         ModuleHelper.AddModuleExportsToAll(m2x, "p2");
   109         ModuleHelper.AddModuleExports(m2x, "p2", m3x);
   109         ModuleHelper.AddModuleExports(m2x, "p2", m3x);
   110 
   110 
   111         // p1.c1's ctor tries to call a method in p2.c2.  This should succeed because
   111         // p1.c1's ctor tries to call a method in p2.c2.  This should succeed because
   112         // p1 is in an unnamed module and p2.c2 is exported unqualifiedly.
   112         // p1 is in an unnamed module and p2.c2 is exported unqualifiedly.