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


Java AbstractInsnNode.METHOD_INSN属性代码示例

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


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

示例1: transformCode

public byte[] transformCode(byte[] b1, String className) throws IOException {
    ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    ClassReader cr = new ClassReader(b1);
    ClassNode classNode = new ClassNode();
    Map<String, Boolean> methodInstructionTypeMap = new HashMap<>();
    cr.accept(classNode, 0);
    final List<MethodNode> methods = classNode.methods;
    for (MethodNode m : methods) {
        InsnList inList = m.instructions;
        boolean isMethodInvoke = false;
        for (int i = 0; i < inList.size(); i++) {
            if (inList.get(i).getType() == AbstractInsnNode.METHOD_INSN) {
                isMethodInvoke = true;
            }
        }
        methodInstructionTypeMap.put(m.name + m.desc, isMethodInvoke);
    }
    InsertMethodBodyAdapter insertMethodBodyAdapter = new InsertMethodBodyAdapter(cw, className, methodInstructionTypeMap);
    cr.accept(insertMethodBodyAdapter, ClassReader.EXPAND_FRAMES);
    return cw.toByteArray();
}
 
开发者ID:Meituan-Dianping,项目名称:Robust,代码行数:21,代码来源:AsmInsertImpl.java

示例2: populateClassGraph

public void populateClassGraph() {
  String className = Type.getObjectType(classNode.name).getClassName();
  logger.debug("Creating graph for class {}" , className);
  for (MethodNode methodNode : classNode.methods) {
    String methodName = methodNode.name;
    MethodGraph caller = new MethodGraph(className, methodName);
    InsnList instructions = methodNode.instructions;
    for (int i = 0; i < instructions.size(); i++) {
      AbstractInsnNode insnNode = instructions.get(i);
      if (insnNode.getType() == AbstractInsnNode.METHOD_INSN) {
        MethodInsnNode methodInsnNode = (MethodInsnNode)insnNode;
        String calledOwner = Type.getObjectType(methodInsnNode.owner).getClassName();
        String calledName = methodInsnNode.name;
        MethodGraph called = new MethodGraph(calledOwner, calledName);
        Call call = new Call(caller, called);
        if (!called.getOwner().equals("java.lang.Object") && !called.getName().equals("<init>")) {
          logger.trace("Adding call graph: {}", call.toString());
          GraphHolder.addCallGraph(call);
        }
      }
    }
  }
}
 
开发者ID:fergarrui,项目名称:custom-bytecode-analyzer,代码行数:23,代码来源:ClassCallGraph.java

示例3: process

@Override
public void process() {
  for (MethodNode methodNode : getClassNode().methods) {
    InsnList instructions = methodNode.instructions;
    for (int i = 0; i < instructions.size(); i++) {
      AbstractInsnNode insnNode = instructions.get(i);
      if (insnNode.getType() == AbstractInsnNode.METHOD_INSN) {
        MethodInsnNode methodInsnNode = (MethodInsnNode)insnNode;
        processMethodInsnNode(methodNode, methodInsnNode);
      }
    }
  }
}
 
开发者ID:fergarrui,项目名称:custom-bytecode-analyzer,代码行数:13,代码来源:CustomMethodInvocationVisitor.java

示例4: updateState

private void updateState(AbstractInsnNode insn) {
  switch (insn.getType()) {
    case AbstractInsnNode.INSN:
      updateState((InsnNode) insn);
      break;
    case AbstractInsnNode.INT_INSN:
      updateState((IntInsnNode) insn);
      break;
    case AbstractInsnNode.VAR_INSN:
      updateState((VarInsnNode) insn);
      break;
    case AbstractInsnNode.TYPE_INSN:
      updateState((TypeInsnNode) insn);
      break;
    case AbstractInsnNode.FIELD_INSN:
      updateState((FieldInsnNode) insn);
      break;
    case AbstractInsnNode.METHOD_INSN:
      updateState((MethodInsnNode) insn);
      break;
    case AbstractInsnNode.INVOKE_DYNAMIC_INSN:
      updateState((InvokeDynamicInsnNode) insn);
      break;
    case AbstractInsnNode.JUMP_INSN:
      updateState((JumpInsnNode) insn);
      break;
    case AbstractInsnNode.LABEL:
      updateState((LabelNode) insn);
      break;
    case AbstractInsnNode.LDC_INSN:
      updateState((LdcInsnNode) insn);
      break;
    case AbstractInsnNode.IINC_INSN:
      updateState((IincInsnNode) insn);
      break;
    case AbstractInsnNode.TABLESWITCH_INSN:
      updateState((TableSwitchInsnNode) insn);
      break;
    case AbstractInsnNode.LOOKUPSWITCH_INSN:
      updateState((LookupSwitchInsnNode) insn);
      break;
    case AbstractInsnNode.MULTIANEWARRAY_INSN:
      updateState((MultiANewArrayInsnNode) insn);
      break;
    case AbstractInsnNode.LINE:
      updateState((LineNumberNode) insn);
      break;
    default:
      throw new Unreachable("Unexpected instruction " + insn);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:51,代码来源:JarSourceCode.java

示例5: build

private void build(AbstractInsnNode insn, IRBuilder builder) {
  switch (insn.getType()) {
    case AbstractInsnNode.INSN:
      build((InsnNode) insn, builder);
      break;
    case AbstractInsnNode.INT_INSN:
      build((IntInsnNode) insn, builder);
      break;
    case AbstractInsnNode.VAR_INSN:
      build((VarInsnNode) insn, builder);
      break;
    case AbstractInsnNode.TYPE_INSN:
      build((TypeInsnNode) insn, builder);
      break;
    case AbstractInsnNode.FIELD_INSN:
      build((FieldInsnNode) insn, builder);
      break;
    case AbstractInsnNode.METHOD_INSN:
      build((MethodInsnNode) insn, builder);
      break;
    case AbstractInsnNode.INVOKE_DYNAMIC_INSN:
      build((InvokeDynamicInsnNode) insn, builder);
      break;
    case AbstractInsnNode.JUMP_INSN:
      build((JumpInsnNode) insn, builder);
      break;
    case AbstractInsnNode.LABEL:
      build((LabelNode) insn, builder);
      break;
    case AbstractInsnNode.LDC_INSN:
      build((LdcInsnNode) insn, builder);
      break;
    case AbstractInsnNode.IINC_INSN:
      build((IincInsnNode) insn, builder);
      break;
    case AbstractInsnNode.TABLESWITCH_INSN:
      build((TableSwitchInsnNode) insn, builder);
      break;
    case AbstractInsnNode.LOOKUPSWITCH_INSN:
      build((LookupSwitchInsnNode) insn, builder);
      break;
    case AbstractInsnNode.MULTIANEWARRAY_INSN:
      build((MultiANewArrayInsnNode) insn, builder);
      break;
    case AbstractInsnNode.LINE:
      build((LineNumberNode) insn, builder);
      break;
    default:
      throw new Unreachable("Unexpected instruction " + insn);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:51,代码来源:JarSourceCode.java

示例6: populate

private void populate() {
	switch (opcode.getType()) {
	case AbstractInsnNode.INSN:
		populate(OpcodeUtil.getInsnSubset(OpcodeUtil.opcodeToName(opcode.getOpcode())));
		break;
	case AbstractInsnNode.INT_INSN:
		populate(OpcodeUtil.OPS_INT);
		break;
	case AbstractInsnNode.VAR_INSN:
		populate(OpcodeUtil.OPS_VAR);
		break;
	case AbstractInsnNode.TYPE_INSN:
		populate(OpcodeUtil.OPS_TYPE);
		break;
	case AbstractInsnNode.FIELD_INSN:
		populate(OpcodeUtil.OPS_FIELD);
		break;
	case AbstractInsnNode.METHOD_INSN:
		populate(OpcodeUtil.OPS_METHOD);
		break;
	case AbstractInsnNode.INVOKE_DYNAMIC_INSN:
		populate(OpcodeUtil.OPS_INDY_METHOD);
		break;
	case AbstractInsnNode.JUMP_INSN:
		populate(OpcodeUtil.OPS_JUMP);
		break;
	case AbstractInsnNode.LDC_INSN:
		populate(OpcodeUtil.OPS_LDC);
		break;
	case AbstractInsnNode.IINC_INSN:
		populate(OpcodeUtil.OPS_IINC);
		break;
	case AbstractInsnNode.TABLESWITCH_INSN:
		populate(OpcodeUtil.OPS_TABLESWITCH);
		break;
	case AbstractInsnNode.LOOKUPSWITCH_INSN:
		populate(OpcodeUtil.OPS_LOOKUPSWITCH);
		break;
	case AbstractInsnNode.MULTIANEWARRAY_INSN:
		populate(OpcodeUtil.OPS_MULTIANEWARRAY);
		break;
	case AbstractInsnNode.LABEL:
	case AbstractInsnNode.LINE:
		break;
	case AbstractInsnNode.FRAME:
		populateFrames(OpcodeUtil.OPS_FRAME);
		break;
	}
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:49,代码来源:OpcodeTypeSwitchPanel.java


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