Package net.bytebuddy.asm
Class Advice.StackMapFrameHandler.Default.WithPreservedArguments
- java.lang.Object
-
- net.bytebuddy.asm.Advice.StackMapFrameHandler.Default
-
- net.bytebuddy.asm.Advice.StackMapFrameHandler.Default.WithPreservedArguments
-
- All Implemented Interfaces:
Advice.StackMapFrameHandler
,Advice.StackMapFrameHandler.ForInstrumentedMethod
- Direct Known Subclasses:
Advice.StackMapFrameHandler.Default.WithPreservedArguments.RequiringConsistentShape
,Advice.StackMapFrameHandler.Default.WithPreservedArguments.UsingArgumentCopy
- Enclosing class:
- Advice.StackMapFrameHandler.Default
protected abstract static class Advice.StackMapFrameHandler.Default.WithPreservedArguments extends Advice.StackMapFrameHandler.Default
A stack map frame handler that requires the original arguments of the instrumented method to be preserved in their original form.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Advice.StackMapFrameHandler.Default.WithPreservedArguments.RequiringConsistentShape
A stack map frame handler that expects that the original argument frames remain preserved throughout the original invocation.protected static class
Advice.StackMapFrameHandler.Default.WithPreservedArguments.UsingArgumentCopy
A stack map frame handler that expects that an argument copy of the original method arguments was made.-
Nested classes/interfaces inherited from class net.bytebuddy.asm.Advice.StackMapFrameHandler.Default
Advice.StackMapFrameHandler.Default.ForAdvice, Advice.StackMapFrameHandler.Default.Initialization, Advice.StackMapFrameHandler.Default.TranslationMode, Advice.StackMapFrameHandler.Default.Trivial, Advice.StackMapFrameHandler.Default.WithPreservedArguments
-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.StackMapFrameHandler
Advice.StackMapFrameHandler.Default, Advice.StackMapFrameHandler.ForInstrumentedMethod, Advice.StackMapFrameHandler.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
allowCompactCompletionFrame
true
if a completion frame for the method bust be a full frame to reflect an initialization change.-
Fields inherited from class net.bytebuddy.asm.Advice.StackMapFrameHandler.Default
currentFrameDivergence, EMPTY, expandFrames, initialTypes, instrumentedMethod, instrumentedType, postMethodTypes, preMethodTypes
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
WithPreservedArguments(TypeDescription instrumentedType, MethodDescription instrumentedMethod, java.util.List<? extends TypeDescription> initialTypes, java.util.List<? extends TypeDescription> preMethodTypes, java.util.List<? extends TypeDescription> postMethodTypes, boolean expandFrames, boolean allowCompactCompletionFrame)
Creates a new stack map frame handler that requires the stack map frames of the original arguments to be preserved.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Advice.StackMapFrameHandler.ForAdvice
bindExit(MethodDescription.InDefinedShape adviceMethod)
Binds this meta data handler for the exit advice.void
injectCompletionFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the completion of the currently handled method, i.e.void
injectExceptionFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the beginning of an exception handler for the currently handled method.void
injectInitializationFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame after initialization if any initialization is performed.void
injectPostCompletionFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the completion of the currently handled method, i.e.void
injectReturnFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the beginning of a return value handler for the currently handled method.protected void
translateFrame(org.objectweb.asm.MethodVisitor methodVisitor, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, MethodDescription methodDescription, java.util.List<? extends TypeDescription> additionalTypes, int type, int localVariableLength, java.lang.Object[] localVariable, int stackSize, java.lang.Object[] stack)
Translates a frame.-
Methods inherited from class net.bytebuddy.asm.Advice.StackMapFrameHandler.Default
bindEnter, getReaderHint, injectFullFrame, of
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.asm.Advice.StackMapFrameHandler
translateFrame
-
Methods inherited from interface net.bytebuddy.asm.Advice.StackMapFrameHandler.ForInstrumentedMethod
injectStartFrame
-
-
-
-
Constructor Detail
-
WithPreservedArguments
protected WithPreservedArguments(TypeDescription instrumentedType, MethodDescription instrumentedMethod, java.util.List<? extends TypeDescription> initialTypes, java.util.List<? extends TypeDescription> preMethodTypes, java.util.List<? extends TypeDescription> postMethodTypes, boolean expandFrames, boolean allowCompactCompletionFrame)
Creates a new stack map frame handler that requires the stack map frames of the original arguments to be preserved.- Parameters:
instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.initialTypes
- A list of virtual method arguments that are explicitly added before any code execution.preMethodTypes
- A list of virtual method arguments that are available before the instrumented method is executed.postMethodTypes
- A list of virtual method arguments that are available after the instrumented method has completed.expandFrames
-true
if the meta data handler is expected to expand its frames.allowCompactCompletionFrame
-true
if a completion frame for the method bust be a full frame to reflect an initialization change.
-
-
Method Detail
-
translateFrame
protected void translateFrame(org.objectweb.asm.MethodVisitor methodVisitor, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, MethodDescription methodDescription, java.util.List<? extends TypeDescription> additionalTypes, int type, int localVariableLength, java.lang.Object[] localVariable, int stackSize, java.lang.Object[] stack)
Description copied from class:Advice.StackMapFrameHandler.Default
Translates a frame.- Overrides:
translateFrame
in classAdvice.StackMapFrameHandler.Default
- Parameters:
methodVisitor
- The method visitor to write the frame to.translationMode
- The translation mode to apply.methodDescription
- The method description for which the frame is written.additionalTypes
- The additional types to consider part of the instrumented method's parameters.type
- The frame's type.localVariableLength
- The local variable length.localVariable
- An array containing the types of the current local variables.stackSize
- The size of the operand stack.stack
- An array containing the types of the current operand stack.
-
bindExit
public Advice.StackMapFrameHandler.ForAdvice bindExit(MethodDescription.InDefinedShape adviceMethod)
Binds this meta data handler for the exit advice.- Parameters:
adviceMethod
- The exit advice method.- Returns:
- An appropriate meta data handler for the enter method.
-
injectReturnFrame
public void injectReturnFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the beginning of a return value handler for the currently handled method.- Parameters:
methodVisitor
- The method visitor onto which to apply the stack map frame.
-
injectExceptionFrame
public void injectExceptionFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the beginning of an exception handler for the currently handled method.- Parameters:
methodVisitor
- The method visitor onto which to apply the stack map frame.
-
injectCompletionFrame
public void injectCompletionFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the completion of the currently handled method, i.e. all yielded types were added.- Parameters:
methodVisitor
- The method visitor onto which to apply the stack map frame.
-
injectPostCompletionFrame
public void injectPostCompletionFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame indicating the completion of the currently handled method, i.e. all yielded types were added.- Parameters:
methodVisitor
- The method visitor onto which to apply the stack map frame.
-
injectInitializationFrame
public void injectInitializationFrame(org.objectweb.asm.MethodVisitor methodVisitor)
Injects a frame after initialization if any initialization is performed.- Parameters:
methodVisitor
- The method visitor to write any frames to.
-
-