@Override public void visitTypeInsn(final int opcode, final String type) { if (opcode == NEW) { InvokeInfo invokeInfo = new InvokeInfo(type, INIT, StringPool.EMPTY); for (InvokeAspect aspect : aspects) { InvokeReplacer ir = aspect.pointcut(invokeInfo); if (ir != null && !ir.isNone()) { newInvokeReplacer = ir; // new pointcut found, skip the new instruction and the following dup. // and then go to the invokespecial return; } } } super.visitTypeInsn(opcode, type); }
@Override public InvokeReplacer pointcut(InvokeInfo invokeInfo) { if ( invokeInfo.getClassName().equals("java.lang.System") && invokeInfo.getMethodName().equals("currentTimeMillis") ) { return InvokeReplacer.with(MySystem.class, "currentTimeMillis"); } return null; } }).proxy().setTarget(TimeClass.class).newInstance();
InvokeInfo invokeInfo = new InvokeInfo(owner, name, desc);
protected InvokeProxetta initProxetta() { return Proxetta.invokeProxetta().withAspects( invokeInfo -> { if (invokeInfo.getMethodName().equals("invvirtual")) { return InvokeReplacer.with(Replacer.class, "rInvVirtual") .passOwnerName(false); if (invokeInfo.getMethodName().equals("invstatic")) { return InvokeReplacer.with(Replacer.class, "rInvStatic") .passOwnerName(true) if (invokeInfo.getMethodName().equals("invinterface")) { return InvokeReplacer.with(Replacer.class, "rInvInterface"); } else { if (invokeInfo.getMethodName().equals("<init>") && invokeInfo.getClassName().equals(Two.class.getCanonicalName())) { return InvokeReplacer.with(Replacer.class, "rInvNew"); } else {
@Override public void visitTypeInsn(int opcode, String type) { if (opcode == NEW) { InvokeInfo invokeInfo = new InvokeInfo(type, INIT, StringPool.EMPTY); for (InvokeAspect aspect : aspects) { InvokeReplacer ir = aspect.pointcut(invokeInfo); if (ir != null) { newInvokeReplacer = ir; // new pointcut found, skip the new instruction and the following dup. // and then go to the invokespecial return; } } } super.visitTypeInsn(opcode, type); }
@Override public void visitTypeInsn(final int opcode, final String type) { if (opcode == NEW) { InvokeInfo invokeInfo = new InvokeInfo(type, INIT, StringPool.EMPTY); for (InvokeAspect aspect : aspects) { InvokeReplacer ir = aspect.pointcut(invokeInfo); if (ir != null && !ir.isNone()) { newInvokeReplacer = ir; // new pointcut found, skip the new instruction and the following dup. // and then go to the invokespecial return; } } } super.visitTypeInsn(opcode, type); }
InvokeInfo invokeInfo = new InvokeInfo(owner, name, desc);
InvokeInfo invokeInfo = new InvokeInfo(owner, name, desc);