Class Advice.MethodSizeHandler.Default
java.lang.Object
net.bytebuddy.asm.Advice.MethodSizeHandler.Default
- All Implemented Interfaces:
Advice.MethodSizeHandler, Advice.MethodSizeHandler.ForInstrumentedMethod
- Direct Known Subclasses:
Advice.MethodSizeHandler.Default.WithCopiedArguments, Advice.MethodSizeHandler.Default.WithRetainedArguments
- Enclosing interface:
Advice.MethodSizeHandler
public abstract static class Advice.MethodSizeHandler.Default
extends Object
implements Advice.MethodSizeHandler.ForInstrumentedMethod
A default implementation for a method size handler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA method size handler for an advice method.protected static classA method size handler that expects that the original arguments were copied.protected static classA method size handler that expects that the original arguments are retained.Nested classes/interfaces inherited from interface Advice.MethodSizeHandler
Advice.MethodSizeHandler.Default, Advice.MethodSizeHandler.ForInstrumentedMethod, Advice.MethodSizeHandler.NoOp -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<? extends TypeDescription> A list of virtual method arguments that are explicitly added before any code execution.protected final MethodDescriptionThe instrumented method.protected intThe maximum length of the local variable array required by a visited advice method.protected final List<? extends TypeDescription> A list of virtual method arguments that are available after the instrumented method has completed.protected final List<? extends TypeDescription> A list of virtual method arguments that are available before the instrumented method is executed.protected intThe maximum stack size required by a visited advice method.Fields inherited from interface Advice.MethodSizeHandler
UNDEFINED_SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault(MethodDescription instrumentedMethod, List<? extends TypeDescription> initialTypes, List<? extends TypeDescription> preMethodTypes, List<? extends TypeDescription> postMethodTypes) Creates a new default meta data handler that recomputes the space requirements of an instrumented method. -
Method Summary
Modifier and TypeMethodDescriptionbindEnter(MethodDescription.TypeToken typeToken) Binds a method size handler for the enter advice.intcompoundLocalVariableLength(int localVariableLength) Computes a compound local variable array length for the advice and the translated instrumented method.intcompoundStackSize(int stackSize) Computes a compound stack size for the advice and the translated instrumented method.protected static Advice.MethodSizeHandler.ForInstrumentedMethodof(MethodDescription instrumentedMethod, List<? extends TypeDescription> initialTypes, List<? extends TypeDescription> preMethodTypes, List<? extends TypeDescription> postMethodTypes, boolean copyArguments, int writerFlags) Creates a method size handler applicable for the given instrumented method.voidrequireLocalVariableLength(int localVariableLength) Requires a minimum length of the local variable array.voidrequireStackSize(int stackSize) Records a minimum stack size required by the represented advice method.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Advice.MethodSizeHandler.ForInstrumentedMethod
bindExit
-
Field Details
-
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. -
stackSize
protected int stackSizeThe maximum stack size required by a visited advice method. -
localVariableLength
protected int localVariableLengthThe maximum length of the local variable array required by a visited advice method.
-
-
Constructor Details
-
Default
protected Default(MethodDescription instrumentedMethod, List<? extends TypeDescription> initialTypes, List<? extends TypeDescription> preMethodTypes, List<? extends TypeDescription> postMethodTypes) Creates a new default meta data handler that recomputes the space requirements of an instrumented method.- Parameters:
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.
-
-
Method Details
-
of
protected static Advice.MethodSizeHandler.ForInstrumentedMethod of(MethodDescription instrumentedMethod, List<? extends TypeDescription> initialTypes, List<? extends TypeDescription> preMethodTypes, List<? extends TypeDescription> postMethodTypes, boolean copyArguments, int writerFlags) Creates a method size handler applicable for the given instrumented method.- Parameters:
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.copyArguments-trueif the original arguments are copied before invoking the instrumented method.writerFlags- The flags supplied to the ASM class writer.- Returns:
- An appropriate method size handler.
-
bindEnter
Binds a method size handler for the enter advice.- Specified by:
bindEnterin interfaceAdvice.MethodSizeHandler.ForInstrumentedMethod- Parameters:
typeToken- The type token representing the enter advice.- Returns:
- A method size handler for the enter advice.
-
requireStackSize
public void requireStackSize(int stackSize) Records a minimum stack size required by the represented advice method.- Specified by:
requireStackSizein interfaceAdvice.MethodSizeHandler- Parameters:
stackSize- The minimum size required by the represented advice method.
-
requireLocalVariableLength
public void requireLocalVariableLength(int localVariableLength) Requires a minimum length of the local variable array.- Specified by:
requireLocalVariableLengthin interfaceAdvice.MethodSizeHandler- Parameters:
localVariableLength- The minimal required length of the local variable array.
-
compoundStackSize
public int compoundStackSize(int stackSize) Computes a compound stack size for the advice and the translated instrumented method.- Specified by:
compoundStackSizein interfaceAdvice.MethodSizeHandler.ForInstrumentedMethod- Parameters:
stackSize- The required stack size of the instrumented method before translation.- Returns:
- The stack size required by the instrumented method and its advice methods.
-
compoundLocalVariableLength
public int compoundLocalVariableLength(int localVariableLength) Computes a compound local variable array length for the advice and the translated instrumented method.- Specified by:
compoundLocalVariableLengthin interfaceAdvice.MethodSizeHandler.ForInstrumentedMethod- Parameters:
localVariableLength- The required local variable array length of the instrumented method before translation.- Returns:
- The local variable length required by the instrumented method and its advice methods.
-