/** * Correct invocations to a method that has been renamed. * If a method is renamed, calls to that method must be also * modified so that the method with the new name will be called. * * <p>The method must be declared in the same class before and * after it is renamed. * * <p>Note that the target object, the parameters, or * the type of invocation * (static method call, interface call, or private method call) * are not modified. Only the method name is changed. * * @param oldMethodName the old name of the method. * @param newMethod the method with the new name. * @see javassist.CtMethod#setName(String) */ public void redirectMethodCall(String oldMethodName, CtMethod newMethod) throws CannotCompileException { transformers = new TransformCall(transformers, oldMethodName, newMethod); }
public void initialize(ConstPool cp, CodeAttribute attr) { super.initialize(cp, attr); locals = 0; maxLocals = attr.getMaxLocals(); saveCode = loadCode = null; }
/** * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL * so that a different method is invoked. The class name in the operand * of these instructions might be a subclass of the target class specified * by <code>classname</code>. This method transforms the instruction * in that case unless the subclass overrides the target method. */ public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = iterator.u16bitAt(pos + 1); String cname = cp.eqMember(methodname, methodDescriptor, index); if (cname != null && matchClass(cname, clazz.getClassPool())) { int ntinfo = cp.getMemberNameAndType(index); pos = match(c, pos, iterator, cp.getNameAndTypeDescriptor(ntinfo), cp); } } return pos; }
/** * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL * so that a different method is invoked. The class name in the operand * of these instructions might be a subclass of the target class specified * by <code>classname</code>. This method transforms the instruction * in that case unless the subclass overrides the target method. */ @Override public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = iterator.u16bitAt(pos + 1); String cname = cp.eqMember(methodname, methodDescriptor, index); if (cname != null && matchClass(cname, clazz.getClassPool())) { int ntinfo = cp.getMemberNameAndType(index); pos = match(c, pos, iterator, cp.getNameAndTypeDescriptor(ntinfo), cp); } } return pos; }
/** * Correct invocations to a method that has been renamed. * If a method is renamed, calls to that method must be also * modified so that the method with the new name will be called. * * <p>The method must be declared in the same class before and * after it is renamed. * * <p>Note that the target object, the parameters, or * the type of invocation * (static method call, interface call, or private method call) * are not modified. Only the method name is changed. * * @param oldMethodName the old name of the method. * @param newMethod the method with the new name. * @see javassist.CtMethod#setName(String) */ public void redirectMethodCall(String oldMethodName, CtMethod newMethod) throws CannotCompileException { transformers = new TransformCall(transformers, oldMethodName, newMethod); }
@Override public void initialize(ConstPool cp, CodeAttribute attr) { super.initialize(cp, attr); locals = 0; maxLocals = attr.getMaxLocals(); saveCode = loadCode = null; }
/** * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL * so that a different method is invoked. The class name in the operand * of these instructions might be a subclass of the target class specified * by <code>classname</code>. This method transforms the instruction * in that case unless the subclass overrides the target method. */ public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = iterator.u16bitAt(pos + 1); String cname = cp.eqMember(methodname, methodDescriptor, index); if (cname != null && matchClass(cname, clazz.getClassPool())) { int ntinfo = cp.getMemberNameAndType(index); pos = match(c, pos, iterator, cp.getNameAndTypeDescriptor(ntinfo), cp); } } return pos; }
+ substMethod.getLongName()); transformers = new TransformCall(transformers, origMethod, substMethod);
public void initialize(ConstPool cp, CodeAttribute attr) { super.initialize(cp, attr); locals = 0; maxLocals = attr.getMaxLocals(); saveCode = loadCode = null; }
/** * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL * so that a different method is invoked. The class name in the operand * of these instructions might be a subclass of the target class specified * by <code>classname</code>. This method transforms the instruction * in that case unless the subclass overrides the target method. */ public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = iterator.u16bitAt(pos + 1); String cname = cp.eqMember(methodname, methodDescriptor, index); if (cname != null && matchClass(cname, clazz.getClassPool())) { int ntinfo = cp.getMemberNameAndType(index); pos = match(c, pos, iterator, cp.getNameAndTypeDescriptor(ntinfo), cp); } } return pos; }
+ substMethod.getLongName()); transformers = new TransformCall(transformers, origMethod, substMethod);
public void initialize(ConstPool cp, CodeAttribute attr) { super.initialize(cp, attr); locals = 0; maxLocals = attr.getMaxLocals(); saveCode = loadCode = null; }
/** * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL * so that a different method is invoked. The class name in the operand * of these instructions might be a subclass of the target class specified * by <code>classname</code>. This method transforms the instruction * in that case unless the subclass overrides the target method. */ public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = iterator.u16bitAt(pos + 1); String cname = cp.eqMember(methodname, methodDescriptor, index); if (cname != null && matchClass(cname, clazz.getClassPool())) { int ntinfo = cp.getMemberNameAndType(index); pos = match(c, pos, iterator, cp.getNameAndTypeDescriptor(ntinfo), cp); } } return pos; }
/** * Correct invocations to a method that has been renamed. * If a method is renamed, calls to that method must be also * modified so that the method with the new name will be called. * * <p>The method must be declared in the same class before and * after it is renamed. * * <p>Note that the target object, the parameters, or * the type of invocation * (static method call, interface call, or private method call) * are not modified. Only the method name is changed. * * @param oldMethodName the old name of the method. * @param newMethod the method with the new name. * @see javassist.CtMethod#setName(String) */ public void redirectMethodCall(String oldMethodName, CtMethod newMethod) throws CannotCompileException { transformers = new TransformCall(transformers, oldMethodName, newMethod); }
public void initialize(ConstPool cp, CodeAttribute attr) { super.initialize(cp, attr); locals = 0; maxLocals = attr.getMaxLocals(); saveCode = loadCode = null; }
/** * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL * so that a different method is invoked. The class name in the operand * of these instructions might be a subclass of the target class specified * by <code>classname</code>. This method transforms the instruction * in that case unless the subclass overrides the target method. */ public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = iterator.u16bitAt(pos + 1); String cname = cp.eqMember(methodname, methodDescriptor, index); if (cname != null && matchClass(cname, clazz.getClassPool())) { int ntinfo = cp.getMemberNameAndType(index); pos = match(c, pos, iterator, cp.getNameAndTypeDescriptor(ntinfo), cp); } } return pos; }
/** * Correct invocations to a method that has been renamed. * If a method is renamed, calls to that method must be also * modified so that the method with the new name will be called. * * <p>The method must be declared in the same class before and * after it is renamed. * * <p>Note that the target object, the parameters, or * the type of invocation * (static method call, interface call, or private method call) * are not modified. Only the method name is changed. * * @param oldMethodName the old name of the method. * @param newMethod the method with the new name. * @see javassist.CtMethod#setName(String) */ public void redirectMethodCall(String oldMethodName, CtMethod newMethod) throws CannotCompileException { transformers = new TransformCall(transformers, oldMethodName, newMethod); }
public void initialize(ConstPool cp, CodeAttribute attr) { super.initialize(cp, attr); locals = 0; maxLocals = attr.getMaxLocals(); saveCode = loadCode = null; }
/** * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL * so that a different method is invoked. The class name in the operand * of these instructions might be a subclass of the target class specified * by <code>classname</code>. This method transforms the instruction * in that case unless the subclass overrides the target method. */ public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = iterator.u16bitAt(pos + 1); String cname = cp.eqMember(methodname, methodDescriptor, index); if (cname != null && matchClass(cname, clazz.getClassPool())) { int ntinfo = cp.getMemberNameAndType(index); pos = match(c, pos, iterator, cp.getNameAndTypeDescriptor(ntinfo), cp); } } return pos; }
/** * Correct invocations to a method that has been renamed. * If a method is renamed, calls to that method must be also * modified so that the method with the new name will be called. * * <p>The method must be declared in the same class before and * after it is renamed. * * <p>Note that the target object, the parameters, or * the type of invocation * (static method call, interface call, or private method call) * are not modified. Only the method name is changed. * * @param oldMethodName the old name of the method. * @param newMethod the method with the new name. * @see javassist.CtMethod#setName(String) */ public void redirectMethodCall(String oldMethodName, CtMethod newMethod) throws CannotCompileException { transformers = new TransformCall(transformers, oldMethodName, newMethod); }