annotate test/compiler/intrinsics/clone/TestObjectClone.java @ 21815:37179dcf830a

Merge
author asaha
date Mon, 20 Oct 2014 23:02:07 -0700
parents 00c8a1255912
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17990
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
1 /*
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
4 *
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
7 * published by the Free Software Foundation.
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
8 *
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
13 * accompanied this code).
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
14 *
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
18 *
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
21 * questions.
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
22 *
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
23 */
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
24
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
25 /*
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
26 * @test
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
27 * @bug 8033626
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
28 * @summary assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
29 * @library /testlibrary
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
30 * @run main/othervm -XX:-TieredCompilation -Xbatch -XX:CompileOnly=TestObjectClone::f TestObjectClone
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
31 */
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
32 import com.oracle.java.testlibrary.Asserts;
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
33
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
34 public class TestObjectClone implements Cloneable {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
35 static class A extends TestObjectClone {}
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
36 static class B extends TestObjectClone {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
37 public B clone() {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
38 return (B)TestObjectClone.b;
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
39 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
40 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
41 static class C extends TestObjectClone {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
42 public C clone() {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
43 return (C)TestObjectClone.c;
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
44 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
45 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
46 static class D extends TestObjectClone {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
47 public D clone() {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
48 return (D)TestObjectClone.d;
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
49 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
50 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
51 static TestObjectClone a = new A(), b = new B(), c = new C(), d = new D();
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
52
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
53 public static Object f(TestObjectClone o) throws CloneNotSupportedException {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
54 // Polymorphic call site: >90% Object::clone / <10% other methods
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
55 return o.clone();
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
56 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
57
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
58 public static void main(String[] args) throws Exception {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
59 TestObjectClone[] params1 = {a, a, a, a, a, a, a, a, a, a, a,
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
60 a, a, a, a, a, a, a, a, a, a, a,
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
61 a, a, a, a, a, a, a, a, a, a, a,
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
62 b, c, d};
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
63
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
64 for (int i = 0; i < 15000; i++) {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
65 f(params1[i % params1.length]);
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
66 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
67
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
68 Asserts.assertTrue(f(a) != a);
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
69 Asserts.assertTrue(f(b) == b);
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
70 Asserts.assertTrue(f(c) == c);
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
71 Asserts.assertTrue(f(d) == d);
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
72
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
73 try {
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
74 f(null);
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
75 throw new AssertionError("");
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
76 } catch (NullPointerException e) { /* expected */ }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
77
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
78 System.out.println("TEST PASSED");
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
79 }
00c8a1255912 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
80 }