Mercurial > hg > truffle
annotate test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java @ 19168:32c7a5a88523
Run unit tests even earlier during gate
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 06 Feb 2015 12:17:20 +0100 |
parents | f3959a2e0eee |
children |
rev | line source |
---|---|
14322
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
1 /* |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
4 * |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
8 * |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
13 * accompanied this code). |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
14 * |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
18 * |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
21 * questions. |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
22 * |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
23 */ |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
24 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
25 /* |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
26 * @test |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
27 * @bug 8032010 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
28 * @summary method lookup on an abstract method in a concrete class should be successful |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
29 * @run main TestConcreteClassWithAbstractMethod |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
30 */ |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
31 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
32 import jdk.internal.org.objectweb.asm.ClassWriter; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
33 import jdk.internal.org.objectweb.asm.MethodVisitor; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
34 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
35 import static jdk.internal.org.objectweb.asm.Opcodes.*; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
36 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
37 /* |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
38 * class T1 { public int m() {} } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
39 * class T2 { public abstract int m(); } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
40 * class T3 { public int m() {} } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
41 * |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
42 * Call site: T3.test() { invokevirtual T2.m() } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
43 * T3.m() should be invoked |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
44 */ |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
45 public class TestConcreteClassWithAbstractMethod { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
46 static final String classT1 = "p1.T1"; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
47 static final String classT2 = "p1.T2"; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
48 static final String classT3 = "p1.T3"; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
49 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
50 static final String callerName = classT3; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
51 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
52 public static void main(String[] args) throws Exception { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
53 ClassLoader cl = new ClassLoader() { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
54 public Class<?> loadClass(String name) throws ClassNotFoundException { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
55 if (findLoadedClass(name) != null) { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
56 return findLoadedClass(name); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
57 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
58 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
59 if (classT1.equals(name)) { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
60 byte[] classFile = dumpT1(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
61 return defineClass(classT1, classFile, 0, classFile.length); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
62 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
63 if (classT2.equals(name)) { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
64 byte[] classFile = dumpT2(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
65 return defineClass(classT2, classFile, 0, classFile.length); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
66 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
67 if (classT3.equals(name)) { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
68 byte[] classFile = dumpT3(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
69 return defineClass(classT3, classFile, 0, classFile.length); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
70 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
71 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
72 return super.loadClass(name); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
73 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
74 }; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
75 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
76 cl.loadClass(classT1); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
77 cl.loadClass(classT2); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
78 cl.loadClass(classT3); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
79 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
80 //cl.loadClass(callerName).getDeclaredMethod("m"); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
81 cl.loadClass(callerName).newInstance(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
82 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
83 int result = (Integer)cl.loadClass(callerName).getDeclaredMethod("test").invoke(null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
84 System.out.println(""+result); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
85 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
86 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
87 public static byte[] dumpT1() { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
88 ClassWriter cw = new ClassWriter(0); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
89 MethodVisitor mv; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
90 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
91 cw.visit(52, ACC_PUBLIC | ACC_SUPER, "p1/T1", null, "java/lang/Object", null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
92 { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
93 mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
94 mv.visitCode(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
95 mv.visitVarInsn(ALOAD, 0); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
96 mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
97 mv.visitInsn(RETURN); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
98 mv.visitMaxs(1, 1); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
99 mv.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
100 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
101 { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
102 mv = cw.visitMethod(ACC_PUBLIC, "m", "()I", null, null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
103 mv.visitCode(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
104 mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
105 mv.visitLdcInsn("p1/T1.m()"); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
106 mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "print", "(Ljava/lang/String;)V", false); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
107 mv.visitIntInsn(BIPUSH, 3); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
108 mv.visitInsn(IRETURN); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
109 mv.visitMaxs(2, 1); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
110 mv.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
111 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
112 cw.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
113 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
114 return cw.toByteArray(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
115 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
116 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
117 public static byte[] dumpT2() { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
118 ClassWriter cw = new ClassWriter(0); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
119 MethodVisitor mv; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
120 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
121 cw.visit(52, ACC_PUBLIC | ACC_SUPER, "p1/T2", null, "p1/T1", null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
122 { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
123 mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
124 mv.visitCode(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
125 mv.visitVarInsn(ALOAD, 0); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
126 mv.visitMethodInsn(INVOKESPECIAL, "p1/T1", "<init>", "()V", false); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
127 mv.visitInsn(RETURN); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
128 mv.visitMaxs(1, 1); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
129 mv.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
130 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
131 { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
132 mv = cw.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "m", "()I", null, null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
133 mv.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
134 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
135 cw.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
136 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
137 return cw.toByteArray(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
138 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
139 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
140 public static byte[] dumpT3() { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
141 ClassWriter cw = new ClassWriter(0); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
142 MethodVisitor mv; |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
143 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
144 cw.visit(52, ACC_PUBLIC + ACC_SUPER, "p1/T3", null, "p1/T2", null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
145 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
146 { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
147 mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
148 mv.visitCode(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
149 mv.visitVarInsn(ALOAD, 0); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
150 mv.visitMethodInsn(INVOKESPECIAL, "p1/T2", "<init>", "()V", false); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
151 mv.visitInsn(RETURN); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
152 mv.visitMaxs(1, 1); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
153 mv.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
154 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
155 { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
156 mv = cw.visitMethod(ACC_PUBLIC, "m", "()I", null, null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
157 mv.visitCode(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
158 mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
159 mv.visitLdcInsn("p1/T3.m()"); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
160 mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "print", "(Ljava/lang/String;)V", false); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
161 mv.visitIntInsn(BIPUSH, 2); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
162 mv.visitInsn(IRETURN); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
163 mv.visitMaxs(2, 1); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
164 mv.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
165 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
166 { |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
167 mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "()I", null, null); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
168 mv.visitCode(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
169 mv.visitTypeInsn(NEW, "p1/T3"); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
170 mv.visitInsn(DUP); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
171 mv.visitMethodInsn(INVOKESPECIAL, "p1/T3", "<init>", "()V", false); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
172 mv.visitMethodInsn(INVOKEVIRTUAL, "p1/T2", "m", "()I", false); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
173 mv.visitInsn(IRETURN); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
174 mv.visitMaxs(3, 2); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
175 mv.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
176 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
177 cw.visitEnd(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
178 |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
179 return cw.toByteArray(); |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
180 } |
f3959a2e0eee
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
181 } |