author | ctornqvi |
Fri, 19 Aug 2016 10:06:30 -0400 | |
changeset 40631 | ed82623d7831 |
parent 38152 | 80e5da81fb2c |
child 40668 | 60d799be5dda |
permissions | -rw-r--r-- |
31353
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
1 |
/* |
36209
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
31353
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
4 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
8 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
13 |
* accompanied this code). |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
14 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
18 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
21 |
* questions. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
22 |
*/ |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
23 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
24 |
/* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
25 |
* @test |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
26 |
* @bug 8076110 |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
27 |
* @summary Redefine running methods that have cached resolution errors |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38152
diff
changeset
|
28 |
* @library /test/lib |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36209
diff
changeset
|
29 |
* @modules java.base/jdk.internal.misc |
36209
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
30 |
* @modules java.base/jdk.internal.org.objectweb.asm |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
31 |
* java.instrument |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
32 |
* jdk.jartool/sun.tools.jar |
31353
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
33 |
* @run main RedefineClassHelper |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
34 |
* @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethodsWithResolutionErrors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
35 |
*/ |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
36 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
37 |
import jdk.internal.org.objectweb.asm.ClassWriter; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
38 |
import jdk.internal.org.objectweb.asm.Label; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
39 |
import jdk.internal.org.objectweb.asm.MethodVisitor; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
40 |
import jdk.internal.org.objectweb.asm.Opcodes; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
41 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
42 |
import java.lang.reflect.InvocationTargetException; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
43 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
44 |
public class RedefineRunningMethodsWithResolutionErrors extends ClassLoader implements Opcodes { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
45 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
46 |
@Override |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
47 |
protected Class<?> findClass(String name) throws ClassNotFoundException { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
48 |
if (name.equals("C")) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
49 |
byte[] b = loadC(false); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
50 |
return defineClass(name, b, 0, b.length); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
51 |
} else { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
52 |
return super.findClass(name); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
53 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
54 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
55 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
56 |
private static byte[] loadC(boolean redefine) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
57 |
ClassWriter cw = new ClassWriter(0); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
58 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
59 |
cw.visit(52, ACC_SUPER | ACC_PUBLIC, "C", null, "java/lang/Object", null); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
60 |
{ |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
61 |
MethodVisitor mv; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
62 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
63 |
mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "m", "()V", null, null); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
64 |
mv.visitCode(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
65 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
66 |
// First time we run we will: |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
67 |
// 1) Cache resolution errors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
68 |
// 2) Redefine the class / method |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
69 |
// 3) Try to read the resolution errors that were cached |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
70 |
// |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
71 |
// The redefined method will never run, throw error to be sure |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
72 |
if (redefine) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
73 |
createThrowRuntimeExceptionCode(mv, "The redefined method was called"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
74 |
} else { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
75 |
createMethodBody(mv); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
76 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
77 |
mv.visitMaxs(3, 0); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
78 |
mv.visitEnd(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
79 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
80 |
cw.visitEnd(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
81 |
return cw.toByteArray(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
82 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
83 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
84 |
private static void createMethodBody(MethodVisitor mv) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
85 |
Label classExists = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
86 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
87 |
// Cache resolution errors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
88 |
createLoadNonExistentClassCode(mv, classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
89 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
90 |
// Redefine our own class and method |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
91 |
mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
92 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
93 |
// Provoke the same error again to make sure the resolution error cache works |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
94 |
createLoadNonExistentClassCode(mv, classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
95 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
96 |
// Test passed |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
97 |
mv.visitInsn(RETURN); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
98 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
99 |
mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
100 |
mv.visitLabel(classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
101 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
102 |
createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
103 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
104 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
105 |
private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
106 |
Label tryLoadBegin = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
107 |
Label tryLoadEnd = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
108 |
Label catchLoadBlock = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
109 |
mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
110 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
111 |
// Try to load a class that does not exist to provoke resolution errors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
112 |
mv.visitLabel(tryLoadBegin); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
113 |
mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
114 |
mv.visitLabel(tryLoadEnd); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
115 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
116 |
// No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
117 |
mv.visitJumpInsn(GOTO, classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
118 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
119 |
mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" }); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
120 |
mv.visitLabel(catchLoadBlock); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
121 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
122 |
// Ignore the expected NoClassDefFoundError |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
123 |
mv.visitInsn(POP); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
124 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
125 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
126 |
private static void createThrowRuntimeExceptionCode(MethodVisitor mv, String msg) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
127 |
mv.visitTypeInsn(NEW, "java/lang/RuntimeException"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
128 |
mv.visitInsn(DUP); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
129 |
mv.visitLdcInsn(msg); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
130 |
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
131 |
mv.visitInsn(ATHROW); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
132 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
133 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
134 |
private static Class<?> c; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
135 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
136 |
public static void redefine() throws Exception { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
137 |
RedefineClassHelper.redefineClass(c, loadC(true)); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
138 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
139 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
140 |
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
141 |
c = Class.forName("C", true, new RedefineRunningMethodsWithResolutionErrors()); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
142 |
c.getMethod("m").invoke(null); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
143 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
144 |
} |