author | jwilhelm |
Thu, 26 Feb 2015 21:00:03 +0100 | |
changeset 29324 | 8672c9d7ae94 |
parent 26558 | b7df27df6384 |
child 29678 | dd2f3932c21e |
permissions | -rw-r--r-- |
24837
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
1 |
/* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
4 |
* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
8 |
* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
13 |
* accompanied this code). |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
14 |
* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
18 |
* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
21 |
* questions. |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
22 |
*/ |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
23 |
|
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
24 |
/* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
25 |
* @test |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
26 |
* @bug 6904403 |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
27 |
* @summary Don't assert if we redefine finalize method |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
28 |
* @library /testlibrary |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
29 |
* @build RedefineClassHelper |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
30 |
* @run main RedefineClassHelper |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
31 |
* @run main/othervm -javaagent:redefineagent.jar RedefineFinalizer |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
32 |
*/ |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
33 |
|
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
34 |
/* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
35 |
* Regression test for hitting: |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
36 |
* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
37 |
* assert(f == k->has_finalizer()) failed: inconsistent has_finalizer |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
38 |
* |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
39 |
* when redefining finalizer method |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
40 |
*/ |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
41 |
public class RedefineFinalizer { |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
42 |
|
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
43 |
public static String newB = |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
44 |
"class RedefineFinalizer$B {" + |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
45 |
" protected void finalize() { " + |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
46 |
" System.out.println(\"Finalizer called\");" + |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
47 |
" }" + |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
48 |
"}"; |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
49 |
|
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
50 |
public static void main(String[] args) throws Exception { |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
51 |
RedefineClassHelper.redefineClass(B.class, newB); |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
52 |
|
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
53 |
A a = new A(); |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
54 |
} |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
55 |
|
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
56 |
static class A extends B { |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
57 |
} |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
58 |
|
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
59 |
static class B { |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
60 |
protected void finalize() { |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
61 |
// should be empty |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
62 |
} |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
63 |
} |
b9c998a3e9fd
8044364: runtime/RedefineFinalizer test fails on windows
ctornqvi
parents:
diff
changeset
|
64 |
} |