Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#INVOKEINTERFACE

The following examples show how to use jdk.internal.org.objectweb.asm.Opcodes#INVOKEINTERFACE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstructionAdapter.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitMethodInsn(
    final int opcode,
    final String owner,
    final String name,
    final String desc)
{
    switch (opcode) {
        case Opcodes.INVOKESPECIAL:
            invokespecial(owner, name, desc);
            break;
        case Opcodes.INVOKEVIRTUAL:
            invokevirtual(owner, name, desc);
            break;
        case Opcodes.INVOKESTATIC:
            invokestatic(owner, name, desc);
            break;
        case Opcodes.INVOKEINTERFACE:
            invokeinterface(owner, name, desc);
            break;
        default:
            throw new IllegalArgumentException();
    }
}
 
Example 2
Source File: InstructionAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    switch (opcode) {
    case Opcodes.INVOKESPECIAL:
        invokespecial(owner, name, desc, itf);
        break;
    case Opcodes.INVOKEVIRTUAL:
        invokevirtual(owner, name, desc, itf);
        break;
    case Opcodes.INVOKESTATIC:
        invokestatic(owner, name, desc, itf);
        break;
    case Opcodes.INVOKEINTERFACE:
        invokeinterface(owner, name, desc);
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
Example 3
Source File: CheckMethodAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    checkStartCode();
    checkEndCode();
    checkOpcode(opcode, 5);
    if (opcode != Opcodes.INVOKESPECIAL || !"<init>".equals(name)) {
        checkMethodIdentifier(version, name, "name");
    }
    checkInternalName(owner, "owner");
    checkMethodDesc(desc);
    if (opcode == Opcodes.INVOKEVIRTUAL && itf) {
        throw new IllegalArgumentException(
                "INVOKEVIRTUAL can't be used with interfaces");
    }
    if (opcode == Opcodes.INVOKEINTERFACE && !itf) {
        throw new IllegalArgumentException(
                "INVOKEINTERFACE can't be used with classes");
    }
    // Calling super.visitMethodInsn requires to call the correct version
    // depending on this.api (otherwise infinite loops can occur). To
    // simplify and to make it easier to automatically remove the backward
    // compatibility code, we inline the code of the overridden method here.
    if (mv != null) {
        mv.visitMethodInsn(opcode, owner, name, desc, itf);
    }
    ++insnCount;
}
 
Example 4
Source File: Printer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method instruction. See
 * {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
 */
@Deprecated
public void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc) {
    if (api >= Opcodes.ASM5) {
        boolean itf = opcode == Opcodes.INVOKEINTERFACE;
        visitMethodInsn(opcode, owner, name, desc, itf);
        return;
    }
    throw new RuntimeException("Must be overriden");
}
 
Example 5
Source File: Printer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method instruction. See
 * {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
 */
@Deprecated
public void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc) {
    if (api >= Opcodes.ASM5) {
        boolean itf = opcode == Opcodes.INVOKEINTERFACE;
        visitMethodInsn(opcode, owner, name, desc, itf);
        return;
    }
    throw new RuntimeException("Must be overriden");
}
 
Example 6
Source File: Printer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method instruction. See
 * {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
 */
public void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    if (api < Opcodes.ASM5) {
        if (itf != (opcode == Opcodes.INVOKEINTERFACE)) {
            throw new IllegalArgumentException(
                    "INVOKESPECIAL/STATIC on interfaces require ASM 5");
        }
        visitMethodInsn(opcode, owner, name, desc);
        return;
    }
    throw new RuntimeException("Must be overriden");
}
 
Example 7
Source File: InvokerBytecodeGenerator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
int refKindOpcode(byte refKind) {
    switch (refKind) {
    case REF_invokeVirtual:      return Opcodes.INVOKEVIRTUAL;
    case REF_invokeStatic:       return Opcodes.INVOKESTATIC;
    case REF_invokeSpecial:      return Opcodes.INVOKESPECIAL;
    case REF_invokeInterface:    return Opcodes.INVOKEINTERFACE;
    case REF_getField:           return Opcodes.GETFIELD;
    case REF_putField:           return Opcodes.PUTFIELD;
    case REF_getStatic:          return Opcodes.GETSTATIC;
    case REF_putStatic:          return Opcodes.PUTSTATIC;
    }
    throw new InternalError("refKind="+refKind);
}
 
Example 8
Source File: CheckMethodAdapter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    checkStartCode();
    checkEndCode();
    checkOpcode(opcode, 5);
    if (opcode != Opcodes.INVOKESPECIAL || !"<init>".equals(name)) {
        checkMethodIdentifier(version, name, "name");
    }
    checkInternalName(owner, "owner");
    checkMethodDesc(desc);
    if (opcode == Opcodes.INVOKEVIRTUAL && itf) {
        throw new IllegalArgumentException(
                "INVOKEVIRTUAL can't be used with interfaces");
    }
    if (opcode == Opcodes.INVOKEINTERFACE && !itf) {
        throw new IllegalArgumentException(
                "INVOKEINTERFACE can't be used with classes");
    }
    // Calling super.visitMethodInsn requires to call the correct version
    // depending on this.api (otherwise infinite loops can occur). To
    // simplify and to make it easier to automatically remove the backward
    // compatibility code, we inline the code of the overridden method here.
    if (mv != null) {
        mv.visitMethodInsn(opcode, owner, name, desc, itf);
    }
    ++insnCount;
}
 
Example 9
Source File: Printer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method instruction. See
 * {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
 */
public void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    if (api < Opcodes.ASM5) {
        if (itf != (opcode == Opcodes.INVOKEINTERFACE)) {
            throw new IllegalArgumentException(
                    "INVOKESPECIAL/STATIC on interfaces require ASM 5");
        }
        visitMethodInsn(opcode, owner, name, desc);
        return;
    }
    throw new RuntimeException("Must be overriden");
}
 
Example 10
Source File: CheckMethodAdapter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    checkStartCode();
    checkEndCode();
    checkOpcode(opcode, 5);
    if (opcode != Opcodes.INVOKESPECIAL || !"<init>".equals(name)) {
        checkMethodIdentifier(version, name, "name");
    }
    checkInternalName(owner, "owner");
    checkMethodDesc(desc);
    if (opcode == Opcodes.INVOKEVIRTUAL && itf) {
        throw new IllegalArgumentException(
                "INVOKEVIRTUAL can't be used with interfaces");
    }
    if (opcode == Opcodes.INVOKEINTERFACE && !itf) {
        throw new IllegalArgumentException(
                "INVOKEINTERFACE can't be used with classes");
    }
    // Calling super.visitMethodInsn requires to call the correct version
    // depending on this.api (otherwise infinite loops can occur). To
    // simplify and to make it easier to automatically remove the backward
    // compatibility code, we inline the code of the overridden method here.
    if (mv != null) {
        mv.visitMethodInsn(opcode, owner, name, desc, itf);
    }
    ++insnCount;
}
 
Example 11
Source File: CheckMethodAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    checkStartCode();
    checkEndCode();
    checkOpcode(opcode, 5);
    if (opcode != Opcodes.INVOKESPECIAL || !"<init>".equals(name)) {
        checkMethodIdentifier(version, name, "name");
    }
    checkInternalName(owner, "owner");
    checkMethodDesc(desc);
    if (opcode == Opcodes.INVOKEVIRTUAL && itf) {
        throw new IllegalArgumentException(
                "INVOKEVIRTUAL can't be used with interfaces");
    }
    if (opcode == Opcodes.INVOKEINTERFACE && !itf) {
        throw new IllegalArgumentException(
                "INVOKEINTERFACE can't be used with classes");
    }
    // Calling super.visitMethodInsn requires to call the correct version
    // depending on this.api (otherwise infinite loops can occur). To
    // simplify and to make it easier to automatically remove the backward
    // compatibility code, we inline the code of the overridden method here.
    if (mv != null) {
        mv.visitMethodInsn(opcode, owner, name, desc, itf);
    }
    ++insnCount;
}
 
Example 12
Source File: Printer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method instruction. See
 * {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
 */
public void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    if (api < Opcodes.ASM5) {
        if (itf != (opcode == Opcodes.INVOKEINTERFACE)) {
            throw new IllegalArgumentException(
                    "INVOKESPECIAL/STATIC on interfaces require ASM 5");
        }
        visitMethodInsn(opcode, owner, name, desc);
        return;
    }
    throw new RuntimeException("Must be overriden");
}
 
Example 13
Source File: Printer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method instruction. See
 * {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
 */
@Deprecated
public void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc) {
    if (api >= Opcodes.ASM5) {
        boolean itf = opcode == Opcodes.INVOKEINTERFACE;
        visitMethodInsn(opcode, owner, name, desc, itf);
        return;
    }
    throw new RuntimeException("Must be overriden");
}
 
Example 14
Source File: Printer.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Method instruction.
 * See {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
 *
 * @param opcode
 *            the opcode of the type instruction to be visited. This opcode
 *            is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
 *            INVOKEINTERFACE.
 * @param owner
 *            the internal name of the method's owner class (see
 *            {@link jdk.internal.org.objectweb.asm.Type#getInternalName() getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link jdk.internal.org.objectweb.asm.Type Type}).
 * @param itf
 *            if the method's owner class is an interface.
 */
public void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    if (api < Opcodes.ASM5) {
        if (itf != (opcode == Opcodes.INVOKEINTERFACE)) {
            throw new IllegalArgumentException(
                    "INVOKESPECIAL/STATIC on interfaces require ASM 5");
        }
        visitMethodInsn(opcode, owner, name, desc);
        return;
    }
    throw new RuntimeException("Must be overriden");
}
 
Example 15
Source File: Printer.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
  * Method instruction. See {@link jdk.internal.org.objectweb.asm.MethodVisitor#visitMethodInsn}.
  *
  * @param opcode the opcode of the type instruction to be visited. This opcode is either
  *     INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
  * @param owner the internal name of the method's owner class (see {@link
  *     jdk.internal.org.objectweb.asm.Type#getInternalName()}).
  * @param name the method's name.
  * @param descriptor the method's descriptor (see {@link jdk.internal.org.objectweb.asm.Type}).
  * @deprecated use {@link #visitMethodInsn(int, String, String, String, boolean)} instead.
  */
@Deprecated
public void visitMethodInsn(
        final int opcode, final String owner, final String name, final String descriptor) {
    if (api >= Opcodes.ASM5) {
        boolean isInterface = opcode == Opcodes.INVOKEINTERFACE;
        visitMethodInsn(opcode, owner, name, descriptor, isInterface);
        return;
    }
    throw new UnsupportedOperationException(UNSUPPORTED_OPERATION);
}
 
Example 16
Source File: MethodInsnNode.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new {@link MethodInsnNode}.
 *
 * @param opcode
 *            the opcode of the type instruction to be constructed. This
 *            opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
 *            INVOKEINTERFACE.
 * @param owner
 *            the internal name of the method's owner class (see
 *            {@link jdk.internal.org.objectweb.asm.Type#getInternalName()
 *            getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link jdk.internal.org.objectweb.asm.Type}).
 */
@Deprecated
public MethodInsnNode(final int opcode, final String owner,
        final String name, final String desc) {
    this(opcode, owner, name, desc, opcode == Opcodes.INVOKEINTERFACE);
}
 
Example 17
Source File: MethodInsnNode.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new {@link MethodInsnNode}.
 *
 * @param opcode
 *            the opcode of the type instruction to be constructed. This
 *            opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
 *            INVOKEINTERFACE.
 * @param owner
 *            the internal name of the method's owner class (see
 *            {@link jdk.internal.org.objectweb.asm.Type#getInternalName()
 *            getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link jdk.internal.org.objectweb.asm.Type}).
 */
@Deprecated
public MethodInsnNode(final int opcode, final String owner,
        final String name, final String desc) {
    this(opcode, owner, name, desc, opcode == Opcodes.INVOKEINTERFACE);
}
 
Example 18
Source File: MethodInsnNode.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
  * Constructs a new {@link MethodInsnNode}.
  *
  * @param opcode the opcode of the type instruction to be constructed. This opcode must be
  *     INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
  * @param owner the internal name of the method's owner class (see {@link
  *     jdk.internal.org.objectweb.asm.Type#getInternalName()}).
  * @param name the method's name.
  * @param descriptor the method's descriptor (see {@link jdk.internal.org.objectweb.asm.Type}).
  * @deprecated use {@link #MethodInsnNode(int, String, String, String, boolean)} instead.
  */
@Deprecated
public MethodInsnNode(
        final int opcode, final String owner, final String name, final String descriptor) {
    this(opcode, owner, name, descriptor, opcode == Opcodes.INVOKEINTERFACE);
}
 
Example 19
Source File: MethodInsnNode.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new {@link MethodInsnNode}.
 *
 * @param opcode
 *            the opcode of the type instruction to be constructed. This
 *            opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
 *            INVOKEINTERFACE.
 * @param owner
 *            the internal name of the method's owner class (see
 *            {@link jdk.internal.org.objectweb.asm.Type#getInternalName()
 *            getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link jdk.internal.org.objectweb.asm.Type}).
 */
@Deprecated
public MethodInsnNode(final int opcode, final String owner,
        final String name, final String desc) {
    this(opcode, owner, name, desc, opcode == Opcodes.INVOKEINTERFACE);
}
 
Example 20
Source File: MethodInsnNode.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new {@link MethodInsnNode}.
 *
 * @param opcode
 *            the opcode of the type instruction to be constructed. This
 *            opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
 *            INVOKEINTERFACE.
 * @param owner
 *            the internal name of the method's owner class (see
 *            {@link jdk.internal.org.objectweb.asm.Type#getInternalName()
 *            getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link jdk.internal.org.objectweb.asm.Type}).
 */
@Deprecated
public MethodInsnNode(final int opcode, final String owner,
        final String name, final String desc) {
    this(opcode, owner, name, desc, opcode == Opcodes.INVOKEINTERFACE);
}