author | chegar |
Tue, 22 Mar 2016 15:26:07 +0000 | |
changeset 36694 | 182a5e7a519e |
parent 30604 | b8d532cb6420 |
child 38152 | 80e5da81fb2c |
permissions | -rw-r--r-- |
24945
6df48e563632
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 |
/* |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
24945
diff
changeset
|
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
24945
6df48e563632
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. |
6df48e563632
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 |
* |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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. |
6df48e563632
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 |
* |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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). |
6df48e563632
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 |
* |
6df48e563632
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 |
6df48e563632
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, |
6df48e563632
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. |
6df48e563632
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 |
* |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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. |
6df48e563632
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 |
* |
6df48e563632
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 |
*/ |
6df48e563632
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 |
|
6df48e563632
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 |
/* |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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 |
6df48e563632
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 |
*/ |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
24945
diff
changeset
|
32 |
import jdk.test.lib.Asserts; |
24945
6df48e563632
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 |
|
6df48e563632
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 { |
6df48e563632
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 {} |
6df48e563632
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 { |
6df48e563632
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() { |
6df48e563632
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; |
6df48e563632
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 |
} |
6df48e563632
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 |
} |
6df48e563632
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 { |
6df48e563632
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() { |
6df48e563632
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; |
6df48e563632
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 |
} |
6df48e563632
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 |
} |
6df48e563632
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 { |
6df48e563632
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() { |
6df48e563632
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; |
6df48e563632
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 |
} |
6df48e563632
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 |
} |
6df48e563632
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(); |
6df48e563632
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 |
|
6df48e563632
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 { |
6df48e563632
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 |
6df48e563632
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(); |
6df48e563632
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 |
} |
6df48e563632
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 |
|
6df48e563632
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 { |
6df48e563632
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, |
6df48e563632
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, |
6df48e563632
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, |
6df48e563632
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}; |
6df48e563632
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 |
|
6df48e563632
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++) { |
6df48e563632
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]); |
6df48e563632
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 |
} |
6df48e563632
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 |
|
6df48e563632
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); |
6df48e563632
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); |
6df48e563632
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); |
6df48e563632
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); |
6df48e563632
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 |
|
6df48e563632
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 { |
6df48e563632
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); |
6df48e563632
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(""); |
6df48e563632
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 */ } |
6df48e563632
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 |
|
6df48e563632
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"); |
6df48e563632
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 |
} |
6df48e563632
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 |
} |