hotspot/test/runtime/8087223/IntfMethod.java
author minqi
Tue, 17 Nov 2015 15:14:29 -0800
changeset 34229 892795cc82fe
permissions -rw-r--r--
8087223: InterfaceMethod CP entry pointing to a class should cause ICCE Summary: Check constantTag for class constant data consistency at method resolution Reviewed-by: coleenp, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34229
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     1
/*
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     4
 *
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     8
 *
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    13
 * accompanied this code).
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    14
 *
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    18
 *
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    21
 * questions.
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    22
 */
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    23
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    24
/*
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    25
 * @test
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    26
 * $bug 8087223
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    27
 * @summary Adding constantTag to keep method call consistent with it.
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    28
 * @compile -XDignore.symbol.file IntfMethod.java
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    29
 * @run main/othervm IntfMethod
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    30
 * @run main/othervm -Xint IntfMethod
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    31
 * @run main/othervm -Xcomp IntfMethod
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    32
 */
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    33
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    34
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    35
import jdk.internal.org.objectweb.asm.*;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    36
import java.io.FileOutputStream;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    37
import java.lang.reflect.InvocationTargetException;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    38
import static jdk.internal.org.objectweb.asm.Opcodes.*;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    39
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    40
public class IntfMethod {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    41
    static byte[] dumpC() {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    42
        ClassWriter cw = new ClassWriter(0);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    43
        cw.visit(52, ACC_PUBLIC | ACC_SUPER, "C", null, "java/lang/Object", new String[]{"I"});
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    44
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    45
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    46
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    47
            mv.visitVarInsn(ALOAD, 0);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    48
            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    49
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    50
            mv.visitMaxs(1, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    51
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    52
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    53
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    54
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testSpecialIntf", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    55
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    56
            mv.visitVarInsn(ALOAD, 0);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    57
            mv.visitMethodInsn(INVOKESPECIAL, "I", "f1", "()V", /*itf=*/false);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    58
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    59
            mv.visitMaxs(1, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    60
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    61
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    62
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    63
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testStaticIntf", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    64
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    65
            mv.visitMethodInsn(INVOKESTATIC, "I", "f2", "()V", /*itf=*/false);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    66
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    67
            mv.visitMaxs(1, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    68
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    69
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    70
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    71
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testSpecialClass", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    72
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    73
            mv.visitVarInsn(ALOAD, 0);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    74
            mv.visitMethodInsn(INVOKESPECIAL, "C", "f1", "()V", /*itf=*/true);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    75
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    76
            mv.visitMaxs(1, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    77
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    78
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    79
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    80
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    81
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "f2", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    82
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    83
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    84
            mv.visitMaxs(0, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    85
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    86
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    87
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    88
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testStaticClass", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    89
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    90
            mv.visitMethodInsn(INVOKESTATIC, "C", "f2", "()V", /*itf=*/true);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    91
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    92
            mv.visitMaxs(1, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    93
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    94
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    95
        cw.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    96
        return cw.toByteArray();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    97
    }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    98
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
    99
    static byte[] dumpI() {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   100
        ClassWriter cw = new ClassWriter(0);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   101
        cw.visit(52, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "I", null, "java/lang/Object", null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   102
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   103
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "f1", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   104
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   105
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   106
            mv.visitMaxs(0, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   107
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   108
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   109
        {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   110
            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "f2", "()V", null, null);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   111
            mv.visitCode();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   112
            mv.visitInsn(RETURN);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   113
            mv.visitMaxs(0, 1);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   114
            mv.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   115
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   116
        cw.visitEnd();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   117
        return cw.toByteArray();
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   118
    }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   119
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   120
    static class CL extends ClassLoader {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   121
        @Override
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   122
        protected Class<?> findClass(String name) throws ClassNotFoundException {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   123
            byte[] classFile;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   124
            switch (name) {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   125
                case "I": classFile = dumpI(); break;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   126
                case "C": classFile = dumpC(); break;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   127
                default:
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   128
                    throw new ClassNotFoundException(name);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   129
            }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   130
            return defineClass(name, classFile, 0, classFile.length);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   131
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   132
    }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   133
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   134
    public static void main(String[] args) throws Throwable {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   135
        Class<?> cls = (new CL()).loadClass("C");
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   136
        try (FileOutputStream fos = new FileOutputStream("I.class")) { fos.write(dumpI()); }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   137
        try (FileOutputStream fos = new FileOutputStream("C.class")) { fos.write(dumpC()); }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   138
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   139
        int success = 0;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   140
        for (String name : new String[] { "testSpecialIntf", "testStaticIntf", "testSpecialClass", "testStaticClass"}) {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   141
            System.out.printf("%s: ", name);
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   142
            try {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   143
                cls.getMethod(name).invoke(cls.newInstance());
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   144
                System.out.println("FAILED");
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   145
            } catch (Throwable e) {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   146
                if (e instanceof InvocationTargetException &&
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   147
                    e.getCause() != null && e.getCause() instanceof IncompatibleClassChangeError) {
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   148
                    System.out.println("PASSED");
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   149
                    success++;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   150
                    continue;
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   151
                }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   152
            }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   153
        }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   154
        if (success != 4) throw new Exception("Failed to catch ICCE");
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   155
    }
892795cc82fe 8087223: InterfaceMethod CP entry pointing to a class should cause ICCE
minqi
parents:
diff changeset
   156
}