author | lana |
Thu, 12 May 2016 15:15:02 +0000 | |
changeset 37915 | be4ff50b6cb6 |
parent 29678 | dd2f3932c21e |
permissions | -rw-r--r-- |
22534
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
1 |
/* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
22534
diff
changeset
|
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
22534
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
4 |
* |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
8 |
* |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
13 |
* accompanied this code). |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
14 |
* |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
18 |
* |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
21 |
* questions. |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
22 |
*/ |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
23 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
24 |
/* |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
25 |
* @test |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
26 |
* @bug 8028553 |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
27 |
* @summary Test that VerifyError is not thrown when 'overriding' a static method. |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
22534
diff
changeset
|
28 |
* @modules java.base/jdk.internal.org.objectweb.asm |
22534
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
29 |
* @run main FinalStatic |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
30 |
*/ |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
31 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
32 |
import java.lang.reflect.*; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
33 |
import jdk.internal.org.objectweb.asm.ClassWriter; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
34 |
import jdk.internal.org.objectweb.asm.MethodVisitor; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
35 |
import jdk.internal.org.objectweb.asm.Opcodes; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
36 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
37 |
/* |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
38 |
* class A { static final int m() {return FAIL; } } |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
39 |
* class B extends A { int m() { return PASS; } } |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
40 |
* class FinalStatic { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
41 |
* public static void main () { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
42 |
* Object b = new B(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
43 |
* b.m(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
44 |
* } |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
45 |
* } |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
46 |
*/ |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
47 |
public class FinalStatic { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
48 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
49 |
static final String CLASS_NAME_A = "A"; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
50 |
static final String CLASS_NAME_B = "B"; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
51 |
static final int FAILED = 0; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
52 |
static final int EXPECTED = 1234; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
53 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
54 |
static class TestClassLoader extends ClassLoader implements Opcodes { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
55 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
56 |
@Override |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
57 |
public Class findClass(String name) throws ClassNotFoundException { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
58 |
byte[] b; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
59 |
try { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
60 |
b = loadClassData(name); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
61 |
} catch (Throwable th) { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
62 |
// th.printStackTrace(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
63 |
throw new ClassNotFoundException("Loading error", th); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
64 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
65 |
return defineClass(name, b, 0, b.length); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
66 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
67 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
68 |
private byte[] loadClassData(String name) throws Exception { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
69 |
ClassWriter cw = new ClassWriter(0); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
70 |
MethodVisitor mv; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
71 |
switch (name) { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
72 |
case CLASS_NAME_A: |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
73 |
cw.visit(52, ACC_SUPER | ACC_PUBLIC, CLASS_NAME_A, null, "java/lang/Object", null); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
74 |
{ |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
75 |
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
76 |
mv.visitCode(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
77 |
mv.visitVarInsn(ALOAD, 0); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
78 |
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
79 |
mv.visitInsn(RETURN); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
80 |
mv.visitMaxs(1, 1); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
81 |
mv.visitEnd(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
82 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
83 |
mv = cw.visitMethod(ACC_FINAL | ACC_STATIC, "m", "()I", null, null); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
84 |
mv.visitCode(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
85 |
mv.visitLdcInsn(FAILED); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
86 |
mv.visitInsn(IRETURN); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
87 |
mv.visitMaxs(1, 1); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
88 |
mv.visitEnd(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
89 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
90 |
break; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
91 |
case CLASS_NAME_B: |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
92 |
cw.visit(52, ACC_SUPER | ACC_PUBLIC, CLASS_NAME_B, null, CLASS_NAME_A, null); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
93 |
{ |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
94 |
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
95 |
mv.visitCode(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
96 |
mv.visitVarInsn(ALOAD, 0); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
97 |
mv.visitMethodInsn(INVOKESPECIAL, CLASS_NAME_A, "<init>", "()V"); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
98 |
mv.visitInsn(RETURN); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
99 |
mv.visitMaxs(1, 1); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
100 |
mv.visitEnd(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
101 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
102 |
mv = cw.visitMethod(ACC_PUBLIC, "m", "()I", null, null); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
103 |
mv.visitCode(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
104 |
mv.visitLdcInsn(EXPECTED); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
105 |
mv.visitInsn(IRETURN); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
106 |
mv.visitMaxs(1, 1); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
107 |
mv.visitEnd(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
108 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
109 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
110 |
break; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
111 |
default: |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
112 |
break; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
113 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
114 |
cw.visitEnd(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
115 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
116 |
return cw.toByteArray(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
117 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
118 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
119 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
120 |
public static void main(String[] args) throws Exception { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
121 |
TestClassLoader tcl = new TestClassLoader(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
122 |
Class<?> a = tcl.loadClass(CLASS_NAME_A); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
123 |
Class<?> b = tcl.loadClass(CLASS_NAME_B); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
124 |
Object inst = b.newInstance(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
125 |
Method[] meths = b.getDeclaredMethods(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
126 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
127 |
Method m = meths[0]; |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
128 |
int mod = m.getModifiers(); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
129 |
if ((mod & Modifier.FINAL) != 0) { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
130 |
throw new Exception("FAILED: " + m + " is FINAL"); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
131 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
132 |
if ((mod & Modifier.STATIC) != 0) { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
133 |
throw new Exception("FAILED: " + m + " is STATIC"); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
134 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
135 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
136 |
m.setAccessible(true); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
137 |
if (!m.invoke(inst).equals(EXPECTED)) { |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
138 |
throw new Exception("FAILED: " + EXPECTED + " from " + m); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
139 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
140 |
|
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
141 |
System.out.println("Passed."); |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
142 |
} |
520f7a937396
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
143 |
} |