Mercurial > hg > truffle
annotate test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java @ 20199:5fbeae2a02d3
8043546: C1 optimizes @Stable instance fields with default values
Reviewed-by: kvn, jrose
author | vlivanov |
---|---|
date | Thu, 10 Jul 2014 12:04:43 -0700 |
parents | a81bc2b2c4d3 |
children |
rev | line source |
---|---|
17666
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
1 /* |
a81bc2b2c4d3
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. |
a81bc2b2c4d3
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. |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
4 * |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
8 * |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
13 * accompanied this code). |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
14 * |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
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, |
a81bc2b2c4d3
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. |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
18 * |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
21 * questions. |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
22 * |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
23 */ |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
24 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
25 /* |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
26 * @test |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
27 * @bug 8032010 |
a81bc2b2c4d3
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 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
29 * @run main TestConcreteClassWithAbstractMethod |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
30 */ |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
31 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
32 import jdk.internal.org.objectweb.asm.ClassWriter; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
33 import jdk.internal.org.objectweb.asm.MethodVisitor; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
34 |
a81bc2b2c4d3
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.*; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
36 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
37 /* |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
38 * class T1 { public int m() {} } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
39 * class T2 { public abstract int m(); } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
40 * class T3 { public int m() {} } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
41 * |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
42 * Call site: T3.test() { invokevirtual T2.m() } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
43 * T3.m() should be invoked |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
44 */ |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
45 public class TestConcreteClassWithAbstractMethod { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
46 static final String classT1 = "p1.T1"; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
47 static final String classT2 = "p1.T2"; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
48 static final String classT3 = "p1.T3"; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
49 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
50 static final String callerName = classT3; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
51 |
a81bc2b2c4d3
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 { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
53 ClassLoader cl = new ClassLoader() { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
54 public Class<?> loadClass(String name) throws ClassNotFoundException { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
55 if (findLoadedClass(name) != null) { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
56 return findLoadedClass(name); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
57 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
58 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
59 if (classT1.equals(name)) { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
60 byte[] classFile = dumpT1(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
61 return defineClass(classT1, classFile, 0, classFile.length); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
62 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
63 if (classT2.equals(name)) { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
64 byte[] classFile = dumpT2(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
65 return defineClass(classT2, classFile, 0, classFile.length); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
66 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
67 if (classT3.equals(name)) { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
68 byte[] classFile = dumpT3(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
69 return defineClass(classT3, classFile, 0, classFile.length); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
70 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
71 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
72 return super.loadClass(name); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
73 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
74 }; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
75 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
76 cl.loadClass(classT1); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
77 cl.loadClass(classT2); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
78 cl.loadClass(classT3); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
79 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
80 //cl.loadClass(callerName).getDeclaredMethod("m"); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
81 cl.loadClass(callerName).newInstance(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
82 |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
84 System.out.println(""+result); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
85 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
86 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
87 public static byte[] dumpT1() { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
88 ClassWriter cw = new ClassWriter(0); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
89 MethodVisitor mv; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
90 |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
92 { |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
94 mv.visitCode(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
95 mv.visitVarInsn(ALOAD, 0); |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
97 mv.visitInsn(RETURN); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
98 mv.visitMaxs(1, 1); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
99 mv.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
100 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
101 { |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
103 mv.visitCode(); |
a81bc2b2c4d3
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;"); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
105 mv.visitLdcInsn("p1/T1.m()"); |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
107 mv.visitIntInsn(BIPUSH, 3); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
108 mv.visitInsn(IRETURN); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
109 mv.visitMaxs(2, 1); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
110 mv.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
111 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
112 cw.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
113 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
114 return cw.toByteArray(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
115 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
116 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
117 public static byte[] dumpT2() { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
118 ClassWriter cw = new ClassWriter(0); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
119 MethodVisitor mv; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
120 |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
122 { |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
124 mv.visitCode(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
125 mv.visitVarInsn(ALOAD, 0); |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
127 mv.visitInsn(RETURN); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
128 mv.visitMaxs(1, 1); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
129 mv.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
130 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
131 { |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
133 mv.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
134 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
135 cw.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
136 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
137 return cw.toByteArray(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
138 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
139 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
140 public static byte[] dumpT3() { |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
141 ClassWriter cw = new ClassWriter(0); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
142 MethodVisitor mv; |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
143 |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
145 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
146 { |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
148 mv.visitCode(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
149 mv.visitVarInsn(ALOAD, 0); |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
151 mv.visitInsn(RETURN); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
152 mv.visitMaxs(1, 1); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
153 mv.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
154 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
155 { |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
157 mv.visitCode(); |
a81bc2b2c4d3
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;"); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
159 mv.visitLdcInsn("p1/T3.m()"); |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
161 mv.visitIntInsn(BIPUSH, 2); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
162 mv.visitInsn(IRETURN); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
163 mv.visitMaxs(2, 1); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
164 mv.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
165 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
166 { |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
168 mv.visitCode(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
169 mv.visitTypeInsn(NEW, "p1/T3"); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
170 mv.visitInsn(DUP); |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
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); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
173 mv.visitInsn(IRETURN); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
174 mv.visitMaxs(3, 2); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
175 mv.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
176 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
177 cw.visitEnd(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
178 |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
179 return cw.toByteArray(); |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
180 } |
a81bc2b2c4d3
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff
changeset
|
181 } |