diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java b/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java index 503aef569b..2447d1f777 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/asm/Advice.java @@ -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); } } @@ -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); @@ -8453,7 +8454,7 @@ public int apply(MethodVisitor methodVisitor, Implementation.Context implementat : defaultJump, noSkip); relocation.apply(methodVisitor); methodVisitor.visitLabel(noSkip); - return requiredSize; + return size; } } } diff --git a/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceLocalVariableArrayTest.java b/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceLocalVariableArrayTest.java index efaf221fb3..a9d55f8dd4 100644 --- a/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceLocalVariableArrayTest.java +++ b/byte-buddy-dep/src/test/java/net/bytebuddy/asm/AdviceLocalVariableArrayTest.java @@ -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 */ }