Mercurial > hg > graal-compiler
annotate test/runtime/finalStatic/FinalStatic.java @ 18244:691e2b53dc63
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 30 Jul 2014 22:28:09 +0200 |
parents | 2e7b5143763f |
children |
rev | line source |
---|---|
14292
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
1 /* |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
2e7b5143763f
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. |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
4 * |
2e7b5143763f
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 |
2e7b5143763f
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 |
2e7b5143763f
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. |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
8 * |
2e7b5143763f
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 |
2e7b5143763f
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 |
2e7b5143763f
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 |
2e7b5143763f
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 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
13 * accompanied this code). |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
14 * |
2e7b5143763f
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 |
2e7b5143763f
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, |
2e7b5143763f
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. |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
18 * |
2e7b5143763f
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 |
2e7b5143763f
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 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
21 * questions. |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
22 */ |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
23 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
24 /* |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
25 * @test |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
26 * @bug 8028553 |
2e7b5143763f
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. |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
28 * @run main FinalStatic |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
29 */ |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
30 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
31 import java.lang.reflect.*; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
32 import jdk.internal.org.objectweb.asm.ClassWriter; |
2e7b5143763f
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.MethodVisitor; |
2e7b5143763f
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.Opcodes; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
35 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
36 /* |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
37 * class A { static final int m() {return FAIL; } } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
38 * class B extends A { int m() { return PASS; } } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
39 * class FinalStatic { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
40 * public static void main () { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
41 * Object b = new B(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
42 * b.m(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
43 * } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
44 * } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
45 */ |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
46 public class FinalStatic { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
47 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
48 static final String CLASS_NAME_A = "A"; |
2e7b5143763f
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_B = "B"; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
50 static final int FAILED = 0; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
51 static final int EXPECTED = 1234; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
52 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
53 static class TestClassLoader extends ClassLoader implements Opcodes { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
54 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
55 @Override |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
56 public Class findClass(String name) throws ClassNotFoundException { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
57 byte[] b; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
58 try { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
59 b = loadClassData(name); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
60 } catch (Throwable th) { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
61 // th.printStackTrace(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
62 throw new ClassNotFoundException("Loading error", th); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
63 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
64 return defineClass(name, b, 0, b.length); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
65 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
66 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
67 private byte[] loadClassData(String name) throws Exception { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
68 ClassWriter cw = new ClassWriter(0); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
69 MethodVisitor mv; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
70 switch (name) { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
71 case CLASS_NAME_A: |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
72 cw.visit(52, ACC_SUPER | ACC_PUBLIC, CLASS_NAME_A, null, "java/lang/Object", null); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
73 { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
74 mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
75 mv.visitCode(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
76 mv.visitVarInsn(ALOAD, 0); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
77 mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
78 mv.visitInsn(RETURN); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
79 mv.visitMaxs(1, 1); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
80 mv.visitEnd(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
81 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
82 mv = cw.visitMethod(ACC_FINAL | ACC_STATIC, "m", "()I", null, null); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
83 mv.visitCode(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
84 mv.visitLdcInsn(FAILED); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
85 mv.visitInsn(IRETURN); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
86 mv.visitMaxs(1, 1); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
87 mv.visitEnd(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
88 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
89 break; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
90 case CLASS_NAME_B: |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
91 cw.visit(52, ACC_SUPER | ACC_PUBLIC, CLASS_NAME_B, null, CLASS_NAME_A, null); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
92 { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
93 mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
94 mv.visitCode(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
95 mv.visitVarInsn(ALOAD, 0); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
96 mv.visitMethodInsn(INVOKESPECIAL, CLASS_NAME_A, "<init>", "()V"); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
97 mv.visitInsn(RETURN); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
98 mv.visitMaxs(1, 1); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
99 mv.visitEnd(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
100 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
101 mv = cw.visitMethod(ACC_PUBLIC, "m", "()I", null, null); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
102 mv.visitCode(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
103 mv.visitLdcInsn(EXPECTED); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
104 mv.visitInsn(IRETURN); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
105 mv.visitMaxs(1, 1); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
106 mv.visitEnd(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
107 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
108 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
109 break; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
110 default: |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
111 break; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
112 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
113 cw.visitEnd(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
114 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
115 return cw.toByteArray(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
116 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
117 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
118 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
119 public static void main(String[] args) throws Exception { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
120 TestClassLoader tcl = new TestClassLoader(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
121 Class<?> a = tcl.loadClass(CLASS_NAME_A); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
122 Class<?> b = tcl.loadClass(CLASS_NAME_B); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
123 Object inst = b.newInstance(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
124 Method[] meths = b.getDeclaredMethods(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
125 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
126 Method m = meths[0]; |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
127 int mod = m.getModifiers(); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
128 if ((mod & Modifier.FINAL) != 0) { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
129 throw new Exception("FAILED: " + m + " is FINAL"); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
130 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
131 if ((mod & Modifier.STATIC) != 0) { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
132 throw new Exception("FAILED: " + m + " is STATIC"); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
133 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
134 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
135 m.setAccessible(true); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
136 if (!m.invoke(inst).equals(EXPECTED)) { |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
137 throw new Exception("FAILED: " + EXPECTED + " from " + m); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
138 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
139 |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
140 System.out.println("Passed."); |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
141 } |
2e7b5143763f
8028553: The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
hseigel
parents:
diff
changeset
|
142 } |