test/runtime/8024804/RegisterNatives.java

Wed, 22 Jan 2014 12:37:28 -0800

author
katleman
date
Wed, 22 Jan 2014 12:37:28 -0800
changeset 6575
2bac854670c0
parent 6167
9fbabcbb875b
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added tag jdk8u5-b05 for changeset b90de55aca30

hseigel@5959 1 /*
hseigel@5959 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
hseigel@5959 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hseigel@5959 4 *
hseigel@5959 5 * This code is free software; you can redistribute it and/or modify it
hseigel@5959 6 * under the terms of the GNU General Public License version 2 only, as
hseigel@5959 7 * published by the Free Software Foundation.
hseigel@5959 8 *
hseigel@5959 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hseigel@5959 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hseigel@5959 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hseigel@5959 12 * version 2 for more details (a copy is included in the LICENSE file that
hseigel@5959 13 * accompanied this code).
hseigel@5959 14 *
hseigel@5959 15 * You should have received a copy of the GNU General Public License version
hseigel@5959 16 * 2 along with this work; if not, write to the Free Software Foundation,
hseigel@5959 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hseigel@5959 18 *
hseigel@5959 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hseigel@5959 20 * or visit www.oracle.com if you need additional information or have any
hseigel@5959 21 * questions.
hseigel@5959 22 */
hseigel@5959 23
hseigel@5959 24 /*
hseigel@5959 25 * @test
hseigel@5959 26 * @bug 8024804
hseigel@6167 27 * @bug 8028741
hseigel@6167 28 * @summary interface method resolution should skip finding j.l.Object's registerNatives() and succeed in selecting class B's registerNatives()
hseigel@5959 29 * @run main RegisterNatives
hseigel@5959 30 */
hseigel@5959 31 public class RegisterNatives {
hseigel@5959 32 interface I { void registerNatives(); }
hseigel@5959 33 interface J extends I {}
hseigel@5959 34 static class B implements J { public void registerNatives() { System.out.println("B"); } }
hseigel@5959 35 public static void main(String... args) {
hseigel@5959 36 System.out.println("Regression test for JDK-8024804, crash when InterfaceMethodref resolves to Object.registerNatives\n");
hseigel@5959 37 J val = new B();
hseigel@5959 38 try {
hseigel@5959 39 val.registerNatives();
hseigel@5959 40 } catch (IllegalAccessError e) {
hseigel@6167 41 System.out.println("TEST FAILS - JDK 8 JVMS, static and non-public methods of j.l.Object should be ignored during interface method resolution\n");
hseigel@6167 42 e.printStackTrace();
hseigel@6167 43 throw e;
hseigel@5959 44 }
hseigel@6167 45 System.out.println("TEST PASSES - no IAE resulted\n");
hseigel@5959 46 }
hseigel@5959 47 }

mercurial