12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 * @test
28 * @summary Test that if module m1 can read module m2, but package p2 in m2
29 * is exported specifically to module m3, then class p1.c1 in m1 can not
30 * access p2.c2 in m2.
31 * @modules java.base/jdk.internal.misc
32 * @library /testlibrary /test/lib
33 * @compile myloaders/MyDiffClassLoader.java
34 * @compile p2/c2.java
35 * @compile p1/c1.java
36 * @build DiffCL_ExpQualOther
37 * @run main/othervm -Xbootclasspath/a:. DiffCL_ExpQualOther
38 */
39
40 import static jdk.test.lib.Asserts.*;
41
42 import java.lang.reflect.Layer;
43 import java.lang.module.Configuration;
44 import java.lang.module.ModuleDescriptor;
45 import java.lang.module.ModuleFinder;
46 import java.util.HashMap;
47 import java.util.Map;
48 import java.util.Set;
49 import myloaders.MyDiffClassLoader;
50
51 //
52 // ClassLoader1 --> defines m1 --> packages p1
53 // ClassLoader2 --> defines m2 --> packages p2
54 // defines m3 --> packages p3
55 //
56 // m1 can read m2
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 * @test
28 * @summary Test that if module m1 can read module m2, but package p2 in m2
29 * is exported specifically to module m3, then class p1.c1 in m1 can not
30 * access p2.c2 in m2.
31 * @modules java.base/jdk.internal.misc
32 * @library /test/lib
33 * @compile myloaders/MyDiffClassLoader.java
34 * @compile p2/c2.java
35 * @compile p1/c1.java
36 * @run main/othervm -Xbootclasspath/a:. DiffCL_ExpQualOther
37 */
38
39 import static jdk.test.lib.Asserts.*;
40
41 import java.lang.reflect.Layer;
42 import java.lang.module.Configuration;
43 import java.lang.module.ModuleDescriptor;
44 import java.lang.module.ModuleFinder;
45 import java.util.HashMap;
46 import java.util.Map;
47 import java.util.Set;
48 import myloaders.MyDiffClassLoader;
49
50 //
51 // ClassLoader1 --> defines m1 --> packages p1
52 // ClassLoader2 --> defines m2 --> packages p2
53 // defines m3 --> packages p3
54 //
55 // m1 can read m2
|