Skip to content

Commit

Permalink
Fix: Check the staticness of the original call not the current one.
Browse files Browse the repository at this point in the history
  • Loading branch information
LlamaLad7 committed Mar 7, 2024
1 parent d7eda8d commit d25e737
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ public static Type[] getOriginalArgs(InjectionNode node) {
}

public static Type[] getCurrentArgs(InjectionNode node) {
MethodInsnNode methodNode = (MethodInsnNode) node.getCurrentTarget();
Type[] currentArgs = Type.getArgumentTypes(methodNode.desc);
if (node.isReplaced() && node.hasDecoration(RedirectInjector.Meta.KEY) && methodNode.getOpcode() != Opcodes.INVOKESTATIC) {
// A non-static redirect handler method will have an extra arg at the start that we don't care about.
MethodInsnNode original = (MethodInsnNode) node.getOriginalTarget();
MethodInsnNode current = (MethodInsnNode) node.getCurrentTarget();
Type[] currentArgs = Type.getArgumentTypes(current.desc);
if (node.isReplaced() && node.hasDecoration(RedirectInjector.Meta.KEY) && original.getOpcode() != Opcodes.INVOKESTATIC) {
// A redirect on a non-static target method will have an extra arg at the start that we don't care about.
return Arrays.copyOfRange(currentArgs, 1, currentArgs.length);
}
return currentArgs;
Expand Down

0 comments on commit d25e737

Please sign in to comment.