annotate test/runtime/8026394/InterfaceObjectTest.java @ 20074:a7ee2e1f0d4e

remove UnboxNodes without usages (if object is non-null)
author Lukas Stadler <lukas.stadler@oracle.com>
date Mon, 30 Mar 2015 13:59:59 +0200
parents 662c154d2749
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12945
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
1 /*
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
4 *
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
7 * published by the Free Software Foundation.
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
8 *
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
13 * accompanied this code).
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
14 *
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
18 *
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
21 * questions.
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
22 */
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
23
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
24 /*
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
25 * @test
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
26 * @bug 8026394
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
27 * @summary clone() and finalize() interface resolution should not receive IAE
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
28 * @run main InterfaceObjectTest
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
29 */
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
30 interface IClone extends Cloneable {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
31 void finalize() throws Throwable;
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
32 Object clone();
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
33 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
34
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
35 interface ICloneExtend extends IClone { }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
36
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
37 public class InterfaceObjectTest implements ICloneExtend {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
38
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
39 public Object clone() {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
40 System.out.println("In InterfaceObjectTest's clone() method\n");
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
41 return null;
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
42 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
43
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
44 public void finalize() throws Throwable {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
45 try {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
46 System.out.println("In InterfaceObjectTest's finalize() method\n");
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
47 } catch (Throwable t) {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
48 throw new AssertionError(t);
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
49 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
50 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
51
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
52 public static void tryIt(ICloneExtend o1) {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
53 try {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
54 Object o2 = o1.clone();
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
55 o1.finalize();
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
56 } catch (Throwable t) {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
57 if (t instanceof IllegalAccessError) {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
58 System.out.println("TEST FAILS - IAE resulted\n");
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
59 System.exit(1);
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
60 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
61 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
62 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
63
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
64 public static void main(String[] args) {
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
65 InterfaceObjectTest o1 = new InterfaceObjectTest();
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
66 tryIt(o1);
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
67 System.out.println("TEST PASSES - no IAE resulted\n");
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
68 }
662c154d2749 8026394: Eclipse fails with JDK8 build 111
hseigel
parents:
diff changeset
69 }