Package net.bytebuddy.asm
Class Advice.StackMapFrameHandler.Default.ForAdvice
java.lang.Object
net.bytebuddy.asm.Advice.StackMapFrameHandler.Default.ForAdvice
- All Implemented Interfaces:
Advice.StackMapFrameHandler
,Advice.StackMapFrameHandler.ForAdvice
,Advice.StackMapFrameHandler.ForPostProcessor
- Enclosing class:
Advice.StackMapFrameHandler.Default
protected class Advice.StackMapFrameHandler.Default.ForAdvice
extends Object
implements Advice.StackMapFrameHandler.ForAdvice
A stack map frame handler for an advice method.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.StackMapFrameHandler
Advice.StackMapFrameHandler.Default, Advice.StackMapFrameHandler.ForAdvice, Advice.StackMapFrameHandler.ForInstrumentedMethod, Advice.StackMapFrameHandler.ForPostProcessor, Advice.StackMapFrameHandler.NoOp
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MethodDescription.InDefinedShape
The method description for which frames are translated.protected final List
<? extends TypeDescription> The types provided after execution of the advice code.private final Advice.StackMapFrameHandler.Default.Initialization
The initialization to apply when resolving a reference to the instance on which a non-static method is invoked.private boolean
true
if an intermediate frame was yielded.private final List
<? extends TypeDescription> The types that are given post execution of the advice.protected final List
<? extends TypeDescription> The types provided before execution of the advice code.protected final Advice.StackMapFrameHandler.Default.TranslationMode
The translation mode to apply for this advice method. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForAdvice
(MethodDescription.InDefinedShape adviceMethod, List<? extends TypeDescription> startTypes, List<? extends TypeDescription> intermediateTypes, List<? extends TypeDescription> endTypes, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, Advice.StackMapFrameHandler.Default.Initialization initialization) Creates a new meta data handler for an advice method. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
injectIntermediateFrame
(org.objectweb.asm.MethodVisitor methodVisitor, List<? extends TypeDescription> stack) Injects a frame that represents the current state.void
injectReturnFrame
(org.objectweb.asm.MethodVisitor methodVisitor) Injects a frame indicating the beginning of a return value handler for the currently handled method.void
translateFrame
(org.objectweb.asm.MethodVisitor methodVisitor, int type, int localVariableLength, Object[] localVariable, int stackSize, Object[] stack) Translates a frame.
-
Field Details
-
adviceMethod
The method description for which frames are translated. -
startTypes
The types provided before execution of the advice code. -
intermediateTypes
The types that are given post execution of the advice. -
endTypes
The types provided after execution of the advice code. -
translationMode
The translation mode to apply for this advice method. Should be eitherAdvice.StackMapFrameHandler.Default.TranslationMode.ENTER
orAdvice.StackMapFrameHandler.Default.TranslationMode.EXIT
. -
initialization
The initialization to apply when resolving a reference to the instance on which a non-static method is invoked. -
intermedate
private boolean intermedatetrue
if an intermediate frame was yielded.
-
-
Constructor Details
-
ForAdvice
protected ForAdvice(MethodDescription.InDefinedShape adviceMethod, List<? extends TypeDescription> startTypes, List<? extends TypeDescription> intermediateTypes, List<? extends TypeDescription> endTypes, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, Advice.StackMapFrameHandler.Default.Initialization initialization) Creates a new meta data handler for an advice method.- Parameters:
adviceMethod
- The method description for which frames are translated.startTypes
- The types provided before execution of the advice code.intermediateTypes
- The types that are given post execution of the advice.endTypes
- The types provided after execution of the advice code.translationMode
- The translation mode to apply for this advice method. Should be eitherAdvice.StackMapFrameHandler.Default.TranslationMode.ENTER
orAdvice.StackMapFrameHandler.Default.TranslationMode.EXIT
.initialization
- The initialization to apply when resolving a reference to the instance on which a non-static method is invoked.
-
-
Method Details
-
translateFrame
public void translateFrame(org.objectweb.asm.MethodVisitor methodVisitor, int type, int localVariableLength, @MaybeNull Object[] localVariable, int stackSize, @MaybeNull Object[] stack) Translates a frame.- Specified by:
translateFrame
in interfaceAdvice.StackMapFrameHandler
- Parameters:
methodVisitor
- The method visitor to write the frame to.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.
-
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.- Specified by:
injectReturnFrame
in interfaceAdvice.StackMapFrameHandler
- 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.- Specified by:
injectExceptionFrame
in interfaceAdvice.StackMapFrameHandler
- 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.- Specified by:
injectCompletionFrame
in interfaceAdvice.StackMapFrameHandler
- Parameters:
methodVisitor
- The method visitor onto which to apply the stack map frame.
-
injectIntermediateFrame
public void injectIntermediateFrame(org.objectweb.asm.MethodVisitor methodVisitor, List<? extends TypeDescription> stack) Injects a frame that represents the current state.- Specified by:
injectIntermediateFrame
in interfaceAdvice.StackMapFrameHandler.ForPostProcessor
- Parameters:
methodVisitor
- The method visitor onto which to apply the stack map frame.stack
- A list of types that are currently on the stack.
-