Package net.bytebuddy.asm
Class Advice.Dispatcher.Inlining.Resolved.ForMethodExit
java.lang.Object
net.bytebuddy.asm.Advice.Dispatcher.Resolved.AbstractBase
net.bytebuddy.asm.Advice.Dispatcher.Inlining.Resolved
net.bytebuddy.asm.Advice.Dispatcher.Inlining.Resolved.ForMethodExit
- All Implemented Interfaces:
Advice.Dispatcher
,Advice.Dispatcher.Resolved
,Advice.Dispatcher.Resolved.ForMethodExit
- Direct Known Subclasses:
Advice.Dispatcher.Inlining.Resolved.ForMethodExit.WithExceptionHandler
,Advice.Dispatcher.Inlining.Resolved.ForMethodExit.WithoutExceptionHandler
- Enclosing class:
Advice.Dispatcher.Inlining.Resolved
@Enhance
protected abstract static class Advice.Dispatcher.Inlining.Resolved.ForMethodExit
extends Advice.Dispatcher.Inlining.Resolved
implements Advice.Dispatcher.Resolved.ForMethodExit
A resolved dispatcher for implementing method exit advice.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Implementation of exit advice that handles exceptions.protected static class
Implementation of exit advice that ignores exceptions.Nested classes/interfaces inherited from class net.bytebuddy.asm.Advice.Dispatcher.Inlining.Resolved
Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner, Advice.Dispatcher.Inlining.Resolved.ForMethodEnter, Advice.Dispatcher.Inlining.Resolved.ForMethodExit
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.Dispatcher
Advice.Dispatcher.Bound, Advice.Dispatcher.Delegating, Advice.Dispatcher.Inactive, Advice.Dispatcher.Inlining, Advice.Dispatcher.RelocationHandler, Advice.Dispatcher.Resolved, Advice.Dispatcher.SuppressionHandler, Advice.Dispatcher.Unresolved
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.Dispatcher.Resolved
Advice.Dispatcher.Resolved.AbstractBase, Advice.Dispatcher.Resolved.ForMethodEnter, Advice.Dispatcher.Resolved.ForMethodExit
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
true
if the arguments of the instrumented method should be copied before executing the instrumented method.private final Map
<String, TypeDefinition> A mapping of uninitialized local variables by their name.Fields inherited from class net.bytebuddy.asm.Advice.Dispatcher.Inlining.Resolved
adviceMethod, classReader
Fields inherited from class net.bytebuddy.asm.Advice.Dispatcher.Resolved.AbstractBase
offsetMappings, postProcessor, relocationHandler, suppressionHandler
Fields inherited from interface net.bytebuddy.asm.Advice.Dispatcher
IGNORE_ANNOTATION, IGNORE_METHOD
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForMethodExit
(MethodDescription.InDefinedShape adviceMethod, Advice.PostProcessor postProcessor, Map<String, TypeDefinition> namedTypes, Map<String, TypeDefinition> uninitializedNamedTypes, List<? extends Advice.OffsetMapping.Factory<?>> userFactories, AsmClassReader classReader, TypeDefinition enterType) Creates a new resolved dispatcher for implementing method exit advice. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.objectweb.asm.MethodVisitor
apply
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.ArgumentHandler.ForInstrumentedMethod argumentHandler, Advice.MethodSizeHandler.ForInstrumentedMethod methodSizeHandler, Advice.StackMapFrameHandler.ForInstrumentedMethod stackMapFrameHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler) Applies a resolution for a given instrumented method.bind
(TypeDescription instrumentedType, MethodDescription instrumentedMethod, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.ArgumentHandler.ForInstrumentedMethod argumentHandler, Advice.MethodSizeHandler.ForInstrumentedMethod methodSizeHandler, Advice.StackMapFrameHandler.ForInstrumentedMethod stackMapFrameHandler, StackManipulation exceptionHandler, Advice.Dispatcher.RelocationHandler.Relocation relocation) Binds this dispatcher for resolution to a specific method.private org.objectweb.asm.MethodVisitor
doApply
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.ArgumentHandler.ForAdvice argumentHandler, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler) Applies a resolution for a given instrumented method.The type that is produced as a result of executing this advice method.Returns a factory for creating anAdvice.ArgumentHandler
.Returns the named types defined by this advice.protected static Advice.Dispatcher.Resolved.ForMethodExit
of
(MethodDescription.InDefinedShape adviceMethod, Advice.PostProcessor postProcessor, Map<String, TypeDefinition> namedTypes, Map<String, TypeDefinition> uninitializedNamedTypes, List<? extends Advice.OffsetMapping.Factory<?>> userFactories, AsmClassReader classReader, TypeDefinition enterType) Resolves exit advice that handles exceptions depending on the specification of the exit advice.protected Map
<Integer, TypeDefinition> resolveInitializationTypes
(Advice.ArgumentHandler argumentHandler) Resolves the initialization types of this advice method.Methods inherited from class net.bytebuddy.asm.Advice.Dispatcher.Resolved.AbstractBase
isAlive
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.Dispatcher
isAlive
Methods inherited from interface net.bytebuddy.asm.Advice.Dispatcher.Resolved.ForMethodExit
getThrowable
-
Field Details
-
uninitializedNamedTypes
A mapping of uninitialized local variables by their name. -
backupArguments
private final boolean backupArgumentstrue
if the arguments of the instrumented method should be copied before executing the instrumented method.
-
-
Constructor Details
-
ForMethodExit
protected ForMethodExit(MethodDescription.InDefinedShape adviceMethod, Advice.PostProcessor postProcessor, Map<String, TypeDefinition> namedTypes, Map<String, TypeDefinition> uninitializedNamedTypes, List<? extends Advice.OffsetMapping.Factory<?>> userFactories, AsmClassReader classReader, TypeDefinition enterType) Creates a new resolved dispatcher for implementing method exit advice.- Parameters:
adviceMethod
- The represented advice method.postProcessor
- The post processor to apply.namedTypes
- A mapping of all available local variables by their name to their type.uninitializedNamedTypes
- A mapping of all uninitialized local variables by their name to their type.userFactories
- A list of user-defined factories for offset mappings.classReader
- The class reader for parsing the advice method's class file.enterType
- The type of the value supplied by the enter advice method orvoid
if no such value exists.
-
-
Method Details
-
of
protected static Advice.Dispatcher.Resolved.ForMethodExit of(MethodDescription.InDefinedShape adviceMethod, Advice.PostProcessor postProcessor, Map<String, TypeDefinition> namedTypes, Map<String, TypeDefinition> uninitializedNamedTypes, List<? extends Advice.OffsetMapping.Factory<?>> userFactories, AsmClassReader classReader, TypeDefinition enterType) Resolves exit advice that handles exceptions depending on the specification of the exit advice.- Parameters:
adviceMethod
- The advice method.postProcessor
- The post processor to apply.namedTypes
- A mapping of all available local variables by their name to their type.uninitializedNamedTypes
- A mapping of all uninitialized local variables by their name to their type.userFactories
- A list of user-defined factories for offset mappings.classReader
- The class reader for parsing the advice method's class file.enterType
- The type of the value supplied by the enter advice method orvoid
if no such value exists.- Returns:
- An appropriate exit handler.
-
getNamedTypes
Returns the named types defined by this advice.- Specified by:
getNamedTypes
in interfaceAdvice.Dispatcher.Resolved
- Returns:
- The named types defined by this advice.
-
resolveInitializationTypes
protected Map<Integer,TypeDefinition> resolveInitializationTypes(Advice.ArgumentHandler argumentHandler) Description copied from class:Advice.Dispatcher.Inlining.Resolved
Resolves the initialization types of this advice method.- Specified by:
resolveInitializationTypes
in classAdvice.Dispatcher.Inlining.Resolved
- Parameters:
argumentHandler
- The argument handler to use for resolving the initialization.- Returns:
- A mapping of parameter offsets to the type to initialize.
-
apply
protected org.objectweb.asm.MethodVisitor apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.ArgumentHandler.ForInstrumentedMethod argumentHandler, Advice.MethodSizeHandler.ForInstrumentedMethod methodSizeHandler, Advice.StackMapFrameHandler.ForInstrumentedMethod stackMapFrameHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler) Description copied from class:Advice.Dispatcher.Inlining.Resolved
Applies a resolution for a given instrumented method.- Specified by:
apply
in classAdvice.Dispatcher.Inlining.Resolved
- Parameters:
methodVisitor
- A method visitor for writing byte code to the instrumented method.implementationContext
- The implementation context to use.assigner
- The assigner to use.argumentHandler
- A handler for accessing values on the local variable array.methodSizeHandler
- A handler for computing the method size requirements.stackMapFrameHandler
- A handler for translating and injecting stack map frames.instrumentedType
- A description of the instrumented type.instrumentedMethod
- A description of the instrumented method.suppressionHandler
- A bound suppression handler that is used for suppressing exceptions of this advice method.relocationHandler
- A bound relocation handler that is responsible for considering a non-standard control flow.exceptionHandler
- The exception handler that is resolved for the instrumented method.- Returns:
- A method visitor for visiting the advice method's byte code.
-
doApply
private org.objectweb.asm.MethodVisitor doApply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.ArgumentHandler.ForAdvice argumentHandler, Advice.MethodSizeHandler.ForAdvice methodSizeHandler, Advice.StackMapFrameHandler.ForAdvice stackMapFrameHandler, TypeDescription instrumentedType, MethodDescription instrumentedMethod, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, Advice.Dispatcher.RelocationHandler.Bound relocationHandler, StackManipulation exceptionHandler) Applies a resolution for a given instrumented method.- Parameters:
methodVisitor
- The method visitor for writing to the instrumented method.implementationContext
- The implementation context to use.assigner
- The assigner to use.argumentHandler
- A handler for accessing values on the local variable array.methodSizeHandler
- A handler for computing the method size requirements.stackMapFrameHandler
- A handler for translating and injecting stack map frames.instrumentedType
- A description of the instrumented type.instrumentedMethod
- The instrumented method that is being bound.suppressionHandler
- The bound suppression handler to use.relocationHandler
- The bound relocation handler to use.exceptionHandler
- The exception handler that is resolved for the instrumented method.- Returns:
- A method visitor for visiting the advice method's byte code.
-
getArgumentHandlerFactory
Returns a factory for creating anAdvice.ArgumentHandler
.- Specified by:
getArgumentHandlerFactory
in interfaceAdvice.Dispatcher.Resolved.ForMethodExit
- Returns:
- A factory for creating an
Advice.ArgumentHandler
.
-
getAdviceType
The type that is produced as a result of executing this advice method.- Specified by:
getAdviceType
in interfaceAdvice.Dispatcher
- Returns:
- A description of the type that is produced by this advice method.
-
bind
public Advice.Dispatcher.Bound bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.ArgumentHandler.ForInstrumentedMethod argumentHandler, Advice.MethodSizeHandler.ForInstrumentedMethod methodSizeHandler, Advice.StackMapFrameHandler.ForInstrumentedMethod stackMapFrameHandler, StackManipulation exceptionHandler, Advice.Dispatcher.RelocationHandler.Relocation relocation) Binds this dispatcher for resolution to a specific method.- Specified by:
bind
in interfaceAdvice.Dispatcher.Resolved
- Parameters:
instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.methodVisitor
- The method visitor for writing the instrumented method.implementationContext
- The implementation context to use.assigner
- The assigner to use.argumentHandler
- A handler for accessing values on the local variable array.methodSizeHandler
- A handler for computing the method size requirements.stackMapFrameHandler
- A handler for translating and injecting stack map frames.exceptionHandler
- The stack manipulation to apply within a suppression handler.relocation
- A relocation to use with a relocation handler.- Returns:
- A dispatcher that is bound to the instrumented method.
-