Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Make ModifyArg ignore the extra receiver parameter of a redirect… #114

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Arrays;
import java.util.List;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.MethodInsnNode;
Expand Down Expand Up @@ -110,6 +111,10 @@ protected void inject(Target target, InjectionNode node) {
protected void injectAtInvoke(Target target, InjectionNode node) {
MethodInsnNode methodNode = (MethodInsnNode)node.getCurrentTarget();
Type[] args = Type.getArgumentTypes(methodNode.desc);
if (node.hasDecoration(RedirectInjector.Meta.KEY) && node.isReplaced() && node.getOriginalTarget().getOpcode() != Opcodes.INVOKESTATIC) {
// A redirect handler method for a virtual target will have an extra arg at the start that we don't care about.
args = Arrays.copyOfRange(args, 1, args.length);
}
int argIndex = this.findArgIndex(target, args);
InsnList insns = new InsnList();
Extension extraLocals = target.extendLocals();
Expand Down