< prev index next >

test/runtime/Nestmates/privateMethods/TestInvokeHierarchy.java

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8046171
  27  * @summary Test access to private methods between nestmates where there
  28  *          is an inheritance hierarchy and we invoke private methods that
  29  *          exist in specific classes in the hierarchy.
  30  * @compile -XDdisablePrivateAccessors TestInvokeHierarchy.java
  31  * @compile ExternalSuper.jcod ExternalSub.jcod
  32  * @run main TestInvokeHierarchy
  33  */
  34 
  35 public class TestInvokeHierarchy {
  36 
  37     static class NestedA extends ExternalSuper {
  38         static final String ID =  "NestedA::priv_invoke";
  39         private String priv_invoke() {
  40             return ID;
  41         }
  42         static void checkA(NestedA a) throws Throwable {
  43             verifyEquals(a.priv_invoke(), NestedA.ID);
  44         }
  45     }
  46 
  47     static class NestedB extends NestedA {
  48         static final String ID =  "NestedB::priv_invoke";
  49         private String priv_invoke() {
  50             return ID;




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8046171
  27  * @summary Test access to private methods between nestmates where there
  28  *          is an inheritance hierarchy and we invoke private methods that
  29  *          exist in specific classes in the hierarchy.
  30  * @compile TestInvokeHierarchy.java
  31  * @compile ExternalSuper.jcod ExternalSub.jcod
  32  * @run main TestInvokeHierarchy
  33  */
  34 
  35 public class TestInvokeHierarchy {
  36 
  37     static class NestedA extends ExternalSuper {
  38         static final String ID =  "NestedA::priv_invoke";
  39         private String priv_invoke() {
  40             return ID;
  41         }
  42         static void checkA(NestedA a) throws Throwable {
  43             verifyEquals(a.priv_invoke(), NestedA.ID);
  44         }
  45     }
  46 
  47     static class NestedB extends NestedA {
  48         static final String ID =  "NestedB::priv_invoke";
  49         private String priv_invoke() {
  50             return ID;


< prev index next >