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 java.lang.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
Fields Modifier and Type Field Description protected java.util.List<? extends TypeDescription>endTypesThe types provided after execution of the advice code.private Advice.StackMapFrameHandler.Default.InitializationinitializationThe initialization to apply when resolving a reference to the instance on which a non-static method is invoked.private booleanintermediatetrueif an intermediate frame was yielded.private java.util.List<? extends TypeDescription>intermediateTypesThe types that are given post execution of the advice.protected java.util.List<? extends TypeDescription>startTypesThe types provided before execution of the advice code.protected Advice.StackMapFrameHandler.Default.TranslationModetranslationModeThe translation mode to apply for this advice method.protected MethodDescription.TypeTokentypeTokenA token for the method description for which frames are translated.
-
Constructor Summary
Constructors Modifier Constructor Description protectedForAdvice(MethodDescription.TypeToken typeToken, java.util.List<? extends TypeDescription> startTypes, java.util.List<? extends TypeDescription> intermediateTypes, java.util.List<? extends TypeDescription> endTypes, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, Advice.StackMapFrameHandler.Default.Initialization initialization)Creates a new metadata handler for an advice method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinjectCompletionFrame(org.objectweb.asm.MethodVisitor methodVisitor)Injects a frame indicating the completion of the currently handled method, i.e.voidinjectExceptionFrame(org.objectweb.asm.MethodVisitor methodVisitor)Injects a frame indicating the beginning of an exception handler for the currently handled method.voidinjectIntermediateFrame(org.objectweb.asm.MethodVisitor methodVisitor, java.util.List<? extends TypeDescription> stack)Injects a frame that represents the current state.voidinjectReturnFrame(org.objectweb.asm.MethodVisitor methodVisitor)Injects a frame indicating the beginning of a return value handler for the currently handled method.voidtranslateFrame(org.objectweb.asm.MethodVisitor methodVisitor, int type, int localVariableLength, java.lang.Object[] localVariable, int stackSize, java.lang.Object[] stack)Translates a frame.
-
-
-
Field Detail
-
typeToken
protected final MethodDescription.TypeToken typeToken
A token for the method description for which frames are translated.
-
startTypes
protected final java.util.List<? extends TypeDescription> startTypes
The types provided before execution of the advice code.
-
intermediateTypes
private final java.util.List<? extends TypeDescription> intermediateTypes
The types that are given post execution of the advice.
-
endTypes
protected final java.util.List<? extends TypeDescription> endTypes
The types provided after execution of the advice code.
-
translationMode
protected final Advice.StackMapFrameHandler.Default.TranslationMode translationMode
The translation mode to apply for this advice method. Should be eitherAdvice.StackMapFrameHandler.Default.TranslationMode.ENTERorAdvice.StackMapFrameHandler.Default.TranslationMode.EXIT.
-
initialization
private final Advice.StackMapFrameHandler.Default.Initialization initialization
The initialization to apply when resolving a reference to the instance on which a non-static method is invoked.
-
intermediate
private boolean intermediate
trueif an intermediate frame was yielded.
-
-
Constructor Detail
-
ForAdvice
protected ForAdvice(MethodDescription.TypeToken typeToken, java.util.List<? extends TypeDescription> startTypes, java.util.List<? extends TypeDescription> intermediateTypes, java.util.List<? extends TypeDescription> endTypes, Advice.StackMapFrameHandler.Default.TranslationMode translationMode, Advice.StackMapFrameHandler.Default.Initialization initialization)
Creates a new metadata handler for an advice method.- Parameters:
typeToken- A token for 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.ENTERorAdvice.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 Detail
-
translateFrame
public void translateFrame(org.objectweb.asm.MethodVisitor methodVisitor, int type, int localVariableLength, @MaybeNull java.lang.Object[] localVariable, int stackSize, @MaybeNull java.lang.Object[] stack)Translates a frame.- Specified by:
translateFramein 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:
injectReturnFramein 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:
injectExceptionFramein 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:
injectCompletionFramein interfaceAdvice.StackMapFrameHandler- Parameters:
methodVisitor- The method visitor onto which to apply the stack map frame.
-
injectIntermediateFrame
public void injectIntermediateFrame(org.objectweb.asm.MethodVisitor methodVisitor, java.util.List<? extends TypeDescription> stack)Injects a frame that represents the current state.- Specified by:
injectIntermediateFramein 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.
-
-