hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java
author shade
Thu, 02 Oct 2014 17:13:31 +0400
changeset 27003 19617f4c9dd0
parent 22739 74105c330330
child 29678 dd2f3932c21e
permissions -rw-r--r--
8059595: Verifier::verify is wasting time before is_eligible_for_verification check Summary: Do the check earlier. Reviewed-by: hseigel, kamg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22739
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
     1
/*
74105c330330 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.
74105c330330 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.
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
     4
 *
74105c330330 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
74105c330330 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
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
     7
 * published by the Free Software Foundation.
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
     8
 *
74105c330330 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
74105c330330 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
74105c330330 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
74105c330330 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
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    13
 * accompanied this code).
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    14
 *
74105c330330 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
74105c330330 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,
74105c330330 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.
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    18
 *
74105c330330 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
74105c330330 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
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    21
 * questions.
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    22
 *
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    23
 */
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    24
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    25
/*
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    26
 * @test
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    27
 * @bug 8032010
74105c330330 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
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    29
 * @run main TestConcreteClassWithAbstractMethod
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    30
 */
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    31
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    32
import jdk.internal.org.objectweb.asm.ClassWriter;
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    33
import jdk.internal.org.objectweb.asm.MethodVisitor;
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    34
74105c330330 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.*;
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    36
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    37
/*
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    38
 *   class T1 { public int m() {} }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    39
 *   class T2 { public abstract int m(); }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    40
 *   class T3 { public int m() {} }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    41
 *
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    42
 *   Call site: T3.test() { invokevirtual T2.m() }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    43
 *   T3.m() should be invoked
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    44
 */
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    45
public class TestConcreteClassWithAbstractMethod {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    46
    static final String classT1 = "p1.T1";
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    47
    static final String classT2 = "p1.T2";
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    48
    static final String classT3 = "p1.T3";
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    49
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    50
    static final String callerName = classT3;
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    51
74105c330330 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 {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    53
        ClassLoader cl = new ClassLoader() {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    54
            public Class<?> loadClass(String name) throws ClassNotFoundException {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    55
                if (findLoadedClass(name) != null) {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    56
                    return findLoadedClass(name);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    57
                }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    58
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    59
                if (classT1.equals(name)) {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    60
                    byte[] classFile = dumpT1();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    61
                    return defineClass(classT1, classFile, 0, classFile.length);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    62
                }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    63
                if (classT2.equals(name)) {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    64
                    byte[] classFile = dumpT2();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    65
                    return defineClass(classT2, classFile, 0, classFile.length);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    66
                }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    67
                if (classT3.equals(name)) {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    68
                    byte[] classFile = dumpT3();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    69
                    return defineClass(classT3, classFile, 0, classFile.length);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    70
                }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    71
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    72
                return super.loadClass(name);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    73
            }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    74
        };
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    75
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    76
        cl.loadClass(classT1);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    77
        cl.loadClass(classT2);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    78
        cl.loadClass(classT3);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    79
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    80
        //cl.loadClass(callerName).getDeclaredMethod("m");
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    81
        cl.loadClass(callerName).newInstance();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    82
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    84
        System.out.println(""+result);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    85
    }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    86
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    87
    public static byte[] dumpT1() {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    88
        ClassWriter cw = new ClassWriter(0);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    89
        MethodVisitor mv;
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    90
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    92
        {
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    94
            mv.visitCode();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    95
            mv.visitVarInsn(ALOAD, 0);
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    97
            mv.visitInsn(RETURN);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    98
            mv.visitMaxs(1, 1);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
    99
            mv.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   100
        }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   101
        {
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   103
            mv.visitCode();
74105c330330 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;");
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   105
            mv.visitLdcInsn("p1/T1.m()");
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   107
            mv.visitIntInsn(BIPUSH, 3);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   108
            mv.visitInsn(IRETURN);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   109
            mv.visitMaxs(2, 1);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   110
            mv.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   111
        }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   112
        cw.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   113
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   114
        return cw.toByteArray();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   115
    }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   116
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   117
    public static byte[] dumpT2() {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   118
        ClassWriter cw = new ClassWriter(0);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   119
        MethodVisitor mv;
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   120
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   122
        {
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   124
            mv.visitCode();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   125
            mv.visitVarInsn(ALOAD, 0);
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   127
            mv.visitInsn(RETURN);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   128
            mv.visitMaxs(1, 1);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   129
            mv.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   130
        }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   131
        {
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   133
            mv.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   134
        }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   135
        cw.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   136
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   137
        return cw.toByteArray();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   138
    }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   139
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   140
    public static byte[] dumpT3() {
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   141
        ClassWriter cw = new ClassWriter(0);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   142
        MethodVisitor mv;
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   143
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   145
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   146
        {
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   148
            mv.visitCode();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   149
            mv.visitVarInsn(ALOAD, 0);
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   151
            mv.visitInsn(RETURN);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   152
            mv.visitMaxs(1, 1);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   153
            mv.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   154
        }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   155
        {
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   157
            mv.visitCode();
74105c330330 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;");
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   159
            mv.visitLdcInsn("p1/T3.m()");
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   161
            mv.visitIntInsn(BIPUSH, 2);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   162
            mv.visitInsn(IRETURN);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   163
            mv.visitMaxs(2, 1);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   164
            mv.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   165
        }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   166
        {
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   168
            mv.visitCode();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   169
            mv.visitTypeInsn(NEW, "p1/T3");
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   170
            mv.visitInsn(DUP);
74105c330330 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);
74105c330330 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);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   173
            mv.visitInsn(IRETURN);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   174
            mv.visitMaxs(3, 2);
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   175
            mv.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   176
        }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   177
        cw.visitEnd();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   178
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   179
        return cw.toByteArray();
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   180
    }
74105c330330 8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
diff changeset
   181
}