Package net.bytebuddy.asm
Class Advice.AdviceVisitor.WithExitAdvice
java.lang.Object
org.objectweb.asm.MethodVisitor
net.bytebuddy.utility.visitor.ExceptionTableSensitiveMethodVisitor
net.bytebuddy.asm.Advice.AdviceVisitor
net.bytebuddy.asm.Advice.AdviceVisitor.WithExitAdvice
- All Implemented Interfaces:
Advice.Dispatcher.RelocationHandler.Relocation
- Direct Known Subclasses:
Advice.AdviceVisitor.WithExitAdvice.WithExceptionHandling
,Advice.AdviceVisitor.WithExitAdvice.WithoutExceptionHandling
- Enclosing class:
Advice.AdviceVisitor
An advice visitor that applies exit advice.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
An advice visitor that captures exceptions by weaving try-catch blocks around user code.protected static class
An advice visitor that does not capture exceptions.Nested classes/interfaces inherited from class net.bytebuddy.asm.Advice.AdviceVisitor
Advice.AdviceVisitor.WithExitAdvice, Advice.AdviceVisitor.WithoutExitAdvice
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.Dispatcher.RelocationHandler.Relocation
Advice.Dispatcher.RelocationHandler.Relocation.ForLabel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.objectweb.asm.Label
Indicates the handler for the value returned by the advice method.Fields inherited from class net.bytebuddy.asm.Advice.AdviceVisitor
argumentHandler, instrumentedMethod, methodExit, methodSizeHandler, stackMapFrameHandler
Fields inherited from class org.objectweb.asm.MethodVisitor
api, mv
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
WithExitAdvice
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, StackManipulation exceptionHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Advice.Dispatcher.Resolved.ForMethodEnter methodEnter, Advice.Dispatcher.Resolved.ForMethodExit methodExit, List<? extends TypeDescription> postMethodTypes, int writerFlags, int readerFlags) Creates an advice visitor that applies exit advice. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(org.objectweb.asm.MethodVisitor methodVisitor) Applies this relocator.protected abstract void
Invoked after the exit advice method has returned.protected void
Writes the advice for completing the instrumented method.protected abstract void
Invoked after the user method has returned.protected void
onVisitInsn
(int opcode) Visits a simple instruction.Methods inherited from class net.bytebuddy.asm.Advice.AdviceVisitor
onAfterExceptionTable, onUserPrepare, onUserStart, onVisitFrame, onVisitIincInsn, onVisitVarInsn, visitLocalVariable, visitLocalVariableAnnotation, visitMaxs
Methods inherited from class net.bytebuddy.utility.visitor.ExceptionTableSensitiveMethodVisitor
onVisitFieldInsn, onVisitIntInsn, onVisitInvokeDynamicInsn, onVisitJumpInsn, onVisitLabel, onVisitLdcInsn, onVisitLookupSwitchInsn, onVisitMethodInsn, onVisitMethodInsn, onVisitMultiANewArrayInsn, onVisitTableSwitchInsn, onVisitTypeInsn, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLookupSwitchInsn, visitMethodInsn, visitMethodInsn, visitMultiANewArrayInsn, visitTableSwitchInsn, visitTypeInsn, visitVarInsn
Methods inherited from class org.objectweb.asm.MethodVisitor
getDelegate, visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitInsnAnnotation, visitLineNumber, visitParameter, visitParameterAnnotation, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation
-
Field Details
-
returnHandler
protected final org.objectweb.asm.Label returnHandlerIndicates the handler for the value returned by the advice method.
-
-
Constructor Details
-
WithExitAdvice
protected WithExitAdvice(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, StackManipulation exceptionHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Advice.Dispatcher.Resolved.ForMethodEnter methodEnter, Advice.Dispatcher.Resolved.ForMethodExit methodExit, List<? extends TypeDescription> postMethodTypes, int writerFlags, int readerFlags) Creates an advice visitor that applies exit advice.- Parameters:
methodVisitor
- The method visitor for the instrumented method.implementationContext
- The implementation context to use.assigner
- The assigner to use.exceptionHandler
- The stack manipulation to apply within a suppression handler.instrumentedType
- A description of the instrumented type.instrumentedMethod
- A description of the instrumented method.methodEnter
- The dispatcher to be used for method enter.methodExit
- The dispatcher to be used for method exit.postMethodTypes
- A list of virtual method arguments that are available after the instrumented method has completed.writerFlags
- The ASM writer flags that were set.readerFlags
- The ASM reader flags that were set.
-
-
Method Details
-
apply
public void apply(org.objectweb.asm.MethodVisitor methodVisitor) Applies this relocator.- Parameters:
methodVisitor
- The method visitor to use.
-
onVisitInsn
protected void onVisitInsn(int opcode) Description copied from class:ExceptionTableSensitiveMethodVisitor
Visits a simple instruction.- Overrides:
onVisitInsn
in classExceptionTableSensitiveMethodVisitor
- Parameters:
opcode
- The opcode of the instruction.
-
onUserEnd
protected void onUserEnd()Description copied from class:Advice.AdviceVisitor
Writes the advice for completing the instrumented method.- Specified by:
onUserEnd
in classAdvice.AdviceVisitor
-
onUserReturn
protected abstract void onUserReturn()Invoked after the user method has returned. -
onExitAdviceReturn
protected abstract void onExitAdviceReturn()Invoked after the exit advice method has returned.
-