Skip to content

Commit

Permalink
Fix advice and test.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Mar 12, 2023
1 parent c8c8123 commit f7cb449
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java
Original file line number Diff line number Diff line change
Expand Up @@ -8354,7 +8354,7 @@ public OfDefault(int index) {
* {@inheritDoc}
*/
public Bound bind(MethodDescription instrumentedMethod, Relocation relocation) {
return new ForValue.Bound(instrumentedMethod, relocation, index, true);
return new ForValue.Bound(instrumentedMethod, relocation, index, false);
}
}

Expand Down Expand Up @@ -8437,6 +8437,7 @@ public int apply(MethodVisitor methodVisitor, Implementation.Context implementat
Label noSkip = new Label();
int size;
if (index < 0) {
size = requiredSize;
methodVisitor.visitVarInsn(load, offset);
} else {
methodVisitor.visitVarInsn(Opcodes.ALOAD, offset);
Expand All @@ -8453,7 +8454,7 @@ public int apply(MethodVisitor methodVisitor, Implementation.Context implementat
: defaultJump, noSkip);
relocation.apply(methodVisitor);
methodVisitor.visitLabel(noSkip);
return requiredSize;
return size;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ public void method(long a, Void b, Void c) {

public static class ShiftVariablesAdvice {

@Advice.OnMethodEnter
static void enter(@Advice.Argument(1) Void ignored) {
/* empty */
}

@Advice.OnMethodExit
static void exit(@Advice.Argument(1) Void ignored) {
/* empty */
}
Expand Down

0 comments on commit f7cb449

Please sign in to comment.