List of usage examples for org.objectweb.asm.tree InsnList accept
public void accept(final MethodVisitor methodVisitor)
From source file:com.sun.tdk.jcov.instrument.InvokeMethodAdapter.java
License:Open Source License
@Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { if ((opcode == GETFIELD || opcode == GETSTATIC) && params.isInstrumentFields() && params.isIncluded(owner) && params.isCallerFilterAccept(className)) { InsnList il = new InsnList(); il.add(new LdcInsnNode(getInvokeID(owner, name, desc))); il.add(new MethodInsnNode(INVOKESTATIC, "com/sun/tdk/jcov/runtime/CollectDetect", "invokeHit", "(I)V")); il.accept(this); }/*from w ww .ja va 2 s. c o m*/ super.visitFieldInsn(opcode, owner, name, desc); }
From source file:com.sun.tdk.jcov.instrument.StaticInvokeMethodAdapter.java
License:Open Source License
@Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { if (params.isInstrumentFields() && params.isIncluded(owner) && params.isCallerFilterAccept(className)) { if (getInvokeID(owner, name, desc) != -1) { int id = getInvokeID(owner, name, desc); InsnList il = new InsnList(); il.add(new LdcInsnNode(id)); il.add(new MethodInsnNode(INVOKESTATIC, "com/sun/tdk/jcov/runtime/Collect", "hit", "(I)V")); il.accept(this); }/*from w ww .j a v a 2 s. com*/ } super.visitFieldInsn(opcode, owner, name, desc); }
From source file:com.sun.tdk.jcov.instrument.StaticInvokeMethodAdapter.java
License:Open Source License
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc) { if ((opcode == INVOKEVIRTUAL || opcode == INVOKEINTERFACE) && params.isInstrumentAbstract() && params.isIncluded(owner)) { if (getInvokeID(owner, name, desc) != -1) { int id = getInvokeID(owner, name, desc); InsnList il = new InsnList(); il.add(new LdcInsnNode(id)); il.add(new MethodInsnNode(INVOKESTATIC, "com/sun/tdk/jcov/runtime/Collect", "hit", "(I)V")); il.accept(this); }//from w ww.j ava 2 s .com } if (params.isCallerFilterOn() && params.isCallerFilterAccept(className)) { int id = (name + desc).hashCode(); super.visitLdcInsn(id); super.visitMethodInsn(INVOKESTATIC, "com/sun/tdk/jcov/runtime/CollectDetect", "setExpected", "(I)V"); } if (params.isInnerInvacationsOff() && Utils.isAdvanceStaticInstrAllowed(className, name)) { if (!owner.equals("java/lang/Object")) { int id = -1; super.visitLdcInsn(id); super.visitMethodInsn(INVOKESTATIC, "com/sun/tdk/jcov/runtime/CollectDetect", "setExpected", "(I)V"); } } super.visitMethodInsn(opcode, owner, name, desc); }
From source file:me.themallard.bitmmo.impl.plugin.chathook.ChatHook.java
License:Open Source License
public void createIsVisible(ClassNode cn) { // again too lazy to make actual work // steal it from original code and hope that it works ;) InsnList method = null; for (MethodNode mn : cn.methods) { if (mn.desc.equals("()Z")) { method = mn.instructions;/*from w ww .j a v a 2 s .c om*/ break; } } MethodVisitor mv = cn.visitMethod(ACC_PUBLIC, "isVisible", "()Z", null, null); method.accept(mv); mv.visitEnd(); }
From source file:me.themallard.bitmmo.impl.plugin.inputactiontracker.InputActionTrackerPlugin.java
License:Open Source License
private void createIsKeyDown(ClassNode cn) { // again too lazy to make actual work // steal it from original code and hope that it works ;) for (MethodNode mn : cn.methods) { if (mn.desc.equals("(LHTMud/InputActionTracker$ActionType;)Z")) { InsnList method = mn.instructions; MethodVisitor mv = cn.visitMethod(ACC_PUBLIC, "isKeyDown", mn.desc, null, null); method.accept(mv); mv.visitEnd();/*from w ww . j a v a2 s . co m*/ break; } } }