当前位置: 首页>>代码示例>>Java>>正文


Java Opcodes.INVOKEINTERFACE属性代码示例

本文整理汇总了Java中org.objectweb.asm.Opcodes.INVOKEINTERFACE属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.INVOKEINTERFACE属性的具体用法?Java Opcodes.INVOKEINTERFACE怎么用?Java Opcodes.INVOKEINTERFACE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.objectweb.asm.Opcodes的用法示例。


在下文中一共展示了Opcodes.INVOKEINTERFACE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doVisitMethodInsn

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();
    }
}
 
开发者ID:acmerli,项目名称:fastAOP,代码行数:19,代码来源:InstructionAdapter.java

示例2: visitMethodInsn

@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
  DexType ownerType = application.getTypeFromName(owner);
  DexMethod method = application.getMethod(ownerType, name, desc);
  switch (opcode) {
    case Opcodes.INVOKEVIRTUAL:
      registry.registerInvokeVirtual(method);
      break;
    case Opcodes.INVOKESTATIC:
      registry.registerInvokeStatic(method);
      break;
    case Opcodes.INVOKEINTERFACE:
      registry.registerInvokeInterface(method);
      break;
    case Opcodes.INVOKESPECIAL:
      if (name.equals(Constants.INSTANCE_INITIALIZER_NAME) || ownerType == clazz) {
        registry.registerInvokeDirect(method);
      } else {
        registry.registerInvokeSuper(method);
      }
      break;
    default:
      throw new Unreachable("Unexpected opcode " + opcode);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:25,代码来源:JarRegisterEffectsVisitor.java

示例3: invokeType

private Invoke.Type invokeType(MethodInsnNode method) {
  switch (method.getOpcode()) {
    case Opcodes.INVOKEVIRTUAL:
      if (isCallToPolymorphicSignatureMethod(method)) {
        return Invoke.Type.POLYMORPHIC;
      }
      return Invoke.Type.VIRTUAL;
    case Opcodes.INVOKESTATIC:
      return Invoke.Type.STATIC;
    case Opcodes.INVOKEINTERFACE:
      return Invoke.Type.INTERFACE;
    case Opcodes.INVOKESPECIAL: {
      DexType owner = application.getTypeFromName(method.owner);
      if (owner == clazz || method.name.equals(Constants.INSTANCE_INITIALIZER_NAME)) {
        return Invoke.Type.DIRECT;
      } else {
        return Invoke.Type.SUPER;
      }
    }
    default:
      throw new Unreachable("Unexpected MethodInsnNode opcode: " + method.getOpcode());
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:23,代码来源:JarSourceCode.java

示例4: visit

/**
 * Output call instructions, outputing the correct opcode for the type of
 * call.
 *
 * @param instruction Call instruction.
 * @return            <code>null</code>
 */
@Override
public Void visit(Call instruction) {
  Method    m = instruction.getMethod();
  ClassNode c = m.getOwner();
  
  int opcode;

  switch(instruction.getSort()) {
    case INTERFACE: opcode = Opcodes.INVOKEINTERFACE; break;
    case VIRTUAL:   opcode = Opcodes.INVOKEVIRTUAL;   break;
    case SPECIAL:   opcode = Opcodes.INVOKESPECIAL;   break;
    case STATIC:    opcode = Opcodes.INVOKESTATIC;    break;
    default:        throw new RuntimeException("Unknown call type");
  }

  mv.visitMethodInsn(opcode, c.getName(), m.getName(), m.getDescriptor());
  
  return null;
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:26,代码来源:InstructionExporter.java

示例5: doVisitMethodInsn

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");
    }
    if (opcode == Opcodes.INVOKESPECIAL && itf
            && (version & 0xFFFF) < Opcodes.V1_8) {
        throw new IllegalArgumentException(
                "INVOKESPECIAL can't be used with interfaces prior to Java 8");
    }

    // 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;
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:33,代码来源:CheckMethodAdapter.java

示例6: check

/**
 * Checks that this method node is compatible with the given ASM API
 * version. This methods checks that this node, and all its nodes
 * recursively, do not contain elements that were introduced in more recent
 * versions of the ASM API than the given version.
 * 
 * @param api
 *            an ASM API version. Must be one of {@link Opcodes#ASM4} or
 *            {@link Opcodes#ASM5}.
 */
public void check(final int api) {
    if (api == Opcodes.ASM4) {
        if (visibleTypeAnnotations != null
                && visibleTypeAnnotations.size() > 0) {
            throw new RuntimeException();
        }
        if (invisibleTypeAnnotations != null
                && invisibleTypeAnnotations.size() > 0) {
            throw new RuntimeException();
        }
        int n = tryCatchBlocks == null ? 0 : tryCatchBlocks.size();
        for (int i = 0; i < n; ++i) {
            TryCatchBlockNode tcb = tryCatchBlocks.get(i);
            if (tcb.visibleTypeAnnotations != null
                    && tcb.visibleTypeAnnotations.size() > 0) {
                throw new RuntimeException();
            }
            if (tcb.invisibleTypeAnnotations != null
                    && tcb.invisibleTypeAnnotations.size() > 0) {
                throw new RuntimeException();
            }
        }
        for (int i = 0; i < instructions.size(); ++i) {
            AbstractInsnNode insn = instructions.get(i);
            if (insn.visibleTypeAnnotations != null
                    && insn.visibleTypeAnnotations.size() > 0) {
                throw new RuntimeException();
            }
            if (insn.invisibleTypeAnnotations != null
                    && insn.invisibleTypeAnnotations.size() > 0) {
                throw new RuntimeException();
            }
            if (insn instanceof MethodInsnNode) {
                boolean itf = ((MethodInsnNode) insn).itf;
                if (itf != (insn.opcode == Opcodes.INVOKEINTERFACE)) {
                    throw new RuntimeException();
                }
            }
        }
        if (visibleLocalVariableAnnotations != null
                && visibleLocalVariableAnnotations.size() > 0) {
            throw new RuntimeException();
        }
        if (invisibleLocalVariableAnnotations != null
                && invisibleLocalVariableAnnotations.size() > 0) {
            throw new RuntimeException();
        }
    }
}
 
开发者ID:acmerli,项目名称:fastAOP,代码行数:59,代码来源:MethodNode.java

示例7: canThrow

private boolean canThrow(AbstractInsnNode insn) {
  switch (insn.getOpcode()) {
    case Opcodes.AALOAD:
    case Opcodes.AASTORE:
    case Opcodes.ANEWARRAY:
      // ARETURN does not throw in its dex image.
    case Opcodes.ARRAYLENGTH:
    case Opcodes.ATHROW:
    case Opcodes.BALOAD:
    case Opcodes.BASTORE:
    case Opcodes.CALOAD:
    case Opcodes.CASTORE:
    case Opcodes.CHECKCAST:
    case Opcodes.DALOAD:
    case Opcodes.DASTORE:
      // DRETURN does not throw in its dex image.
    case Opcodes.FALOAD:
    case Opcodes.FASTORE:
      // FRETURN does not throw in its dex image.
    case Opcodes.GETFIELD:
    case Opcodes.GETSTATIC:
    case Opcodes.IALOAD:
    case Opcodes.IASTORE:
    case Opcodes.IDIV:
    case Opcodes.INSTANCEOF:
    case Opcodes.INVOKEDYNAMIC:
    case Opcodes.INVOKEINTERFACE:
    case Opcodes.INVOKESPECIAL:
    case Opcodes.INVOKESTATIC:
    case Opcodes.INVOKEVIRTUAL:
    case Opcodes.IREM:
      // IRETURN does not throw in its dex image.
    case Opcodes.LALOAD:
    case Opcodes.LASTORE:
    case Opcodes.LDIV:
    case Opcodes.LREM:
      // LRETURN does not throw in its dex image.
    case Opcodes.MONITORENTER:
    case Opcodes.MONITOREXIT:
    case Opcodes.MULTIANEWARRAY:
    case Opcodes.NEW:
    case Opcodes.NEWARRAY:
    case Opcodes.PUTFIELD:
    case Opcodes.PUTSTATIC:
      // RETURN does not throw in its dex image.
    case Opcodes.SALOAD:
    case Opcodes.SASTORE:
      return true;
    case Opcodes.LDC: {
      // const-class and const-string* may throw in dex.
      LdcInsnNode ldc = (LdcInsnNode) insn;
      return ldc.cst instanceof String || ldc.cst instanceof Type;
    }
    default:
      return false;
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:57,代码来源:JarSourceCode.java

示例8: create

/**
 * Create an opcode from the current open card. If there's an input
 * exception no node is returned.
 *
 * @return The opcode created.
 */
public AbstractInsnNode create() {
	try {
		switch (nameToType.get(currentType)) {
		case AbstractInsnNode.INSN:
			return new InsnNode(getOpcode());
		case AbstractInsnNode.INT_INSN:
			return new IntInsnNode(getOpcode(), getInt("value"));
		case AbstractInsnNode.VAR_INSN:
			return new VarInsnNode(getOpcode(), getInt("var"));
		case AbstractInsnNode.TYPE_INSN:
			return new TypeInsnNode(getOpcode(), getString("value"));
		case AbstractInsnNode.FIELD_INSN:
			return new FieldInsnNode(getOpcode(), getString("owner"), getString("name"), getString("desc"));
		case AbstractInsnNode.METHOD_INSN:
			return new MethodInsnNode(getOpcode(), getString("owner"), getString("name"), getString("desc"),
					getOpcode() == Opcodes.INVOKEINTERFACE);
		case AbstractInsnNode.INVOKE_DYNAMIC_INSN:
			break;
		case AbstractInsnNode.LABEL:
			return new LabelNode();
		case AbstractInsnNode.LDC_INSN:
			String ldcStr = get("value");
			Object cst = null;
			switch (comboType.getSelectedItem().toString()) {
			case "String":
				cst = ldcStr;
				break;
			case "int":
				cst = Integer.parseInt(ldcStr);
				break;
			case "long":
				cst = Long.parseLong(ldcStr);
				break;
			case "float":
				cst = Float.parseFloat(ldcStr);
				break;
			case "double":
				cst = Double.parseDouble(ldcStr);
				break;
			case "Type":
				cst = Type.getType(ldcStr);
				break;
			}
			return new LdcInsnNode(cst);
		case AbstractInsnNode.IINC_INSN:
			return new IincInsnNode(getInt("var"), getInt("inc"));
		case AbstractInsnNode.LINE:
			return new LineNumberNode(getInt("value"), new LabelNode());
		case AbstractInsnNode.MULTIANEWARRAY_INSN:
			return new MultiANewArrayInsnNode(getString("desc"), getInt("dims"));
		case AbstractInsnNode.JUMP_INSN:
			return new JumpInsnNode(getOpcode(), getLabel("value"));
		case AbstractInsnNode.TABLESWITCH_INSN:
			break;
		case AbstractInsnNode.LOOKUPSWITCH_INSN:
			break;
		case AbstractInsnNode.FRAME:
			break;
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:70,代码来源:OpcodeCreationBox.java

示例9: visitMethodInsn

/**
 * Method instruction.
 * See {@link 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 org.objectweb.asm.Type#getInternalName() getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link org.objectweb.asm.Type Type}).
 */
@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");
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:26,代码来源:Printer.java

示例10: visitMethodInsn

/**
 * Method instruction.
 * See {@link 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 org.objectweb.asm.Type#getInternalName() getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link 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");
}
 
开发者ID:acmerli,项目名称:fastAOP,代码行数:30,代码来源:Printer.java

示例11: MethodInsnNode

/**
 * 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 org.objectweb.asm.Type#getInternalName()
 *            getInternalName}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link 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);
}
 
开发者ID:ItzSomebody,项目名称:Spigot-Nonce-ID-Finder,代码行数:21,代码来源:MethodInsnNode.java


注:本文中的org.objectweb.asm.Opcodes.INVOKEINTERFACE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。