hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod
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.
    24 /*
    24 /*
    25  * package p3;
    25  * package p3;
    26  * import java.lang.reflect.*;
    26  * import java.lang.reflect.*;
    27  * public class c3ReadEdge {
    27  * public class c3ReadEdge {
    28  *    public c3ReadEdge() {
    28  *    public c3ReadEdge() {
    29  *       // Establish read edge from module m1, where c3ReadEdge is defined,
    29  *       // Establish read edge from module m1x, where c3ReadEdge is defined,
    30  *       // to the unnamed module, where c4 will be defined.
    30  *       // to the unnamed module, where c4 will be defined.
    31  *       Module m1 = c3ReadEdge.class.getModule();
    31  *       Module m1x = c3ReadEdge.class.getModule();
    32  *       ClassLoader loader = c3ReadEdge.class.getClassLoader();
    32  *       ClassLoader loader = c3ReadEdge.class.getClassLoader();
    33  *       Module unnamed_module = loader.getUnnamedModule();
    33  *       Module unnamed_module = loader.getUnnamedModule();
    34  *       m1.addReads(unnamed_module);
    34  *       m1x.addReads(unnamed_module);
    35  *       // Attempt access - access should succeed
    35  *       // Attempt access - access should succeed
    36  *       c4 c4_obj = new c4();
    36  *       c4 c4_obj = new c4();
    37  *       c4_obj.method4();
    37  *       c4_obj.method4();
    38  *   }
    38  *   }
    39  * }
    39  * }