hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java
changeset 43665 4bb003cad9b9
parent 36508 5f9eee6b383b
child 44520 0553e129e0ec
equal deleted inserted replaced
43606:a5aa7536131c 43665:4bb003cad9b9
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    25 import java.lang.reflect.*;
    25 import java.lang.reflect.*;
    26 import p2.c2;
    26 import p2.c2;
    27 
    27 
    28 public class c1ReadEdge {
    28 public class c1ReadEdge {
    29     public c1ReadEdge() {
    29     public c1ReadEdge() {
    30         // Establish read edge from module m1, where c1ReadEdge is defined,
    30         // Establish read edge from module m1x, where c1ReadEdge is defined,
    31         // to the unnamed module, where p2.c2 will be defined.
    31         // to the unnamed module, where p2.c2 will be defined.
    32         Module m1 = c1ReadEdge.class.getModule();
    32         Module m1x = c1ReadEdge.class.getModule();
    33         ClassLoader loader = c1ReadEdge.class.getClassLoader();
    33         ClassLoader loader = c1ReadEdge.class.getClassLoader();
    34         Module unnamed_module = loader.getUnnamedModule();
    34         Module unnamed_module = loader.getUnnamedModule();
    35         m1.addReads(unnamed_module);
    35         m1x.addReads(unnamed_module);
    36 
    36 
    37         // Attempt access - access should succeed
    37         // Attempt access - access should succeed
    38         p2.c2 c2_obj = new p2.c2();
    38         p2.c2 c2_obj = new p2.c2();
    39         c2_obj.method2();
    39         c2_obj.method2();
    40     }
    40     }