Class Advice.MethodSizeHandler.Default

    • Field Detail

      • instrumentedMethod

        protected final MethodDescription instrumentedMethod
        The instrumented method.
      • initialTypes

        protected final java.util.List<? extends TypeDescription> initialTypes
        A list of virtual method arguments that are explicitly added before any code execution.
      • preMethodTypes

        protected final java.util.List<? extends TypeDescription> preMethodTypes
        A list of virtual method arguments that are available before the instrumented method is executed.
      • postMethodTypes

        protected final java.util.List<? extends TypeDescription> postMethodTypes
        A list of virtual method arguments that are available after the instrumented method has completed.
      • stackSize

        protected int stackSize
        The maximum stack size required by a visited advice method.
      • localVariableLength

        protected int localVariableLength
        The maximum length of the local variable array required by a visited advice method.
    • Constructor Detail

      • Default

        protected Default​(MethodDescription instrumentedMethod,
                          java.util.List<? extends TypeDescription> initialTypes,
                          java.util.List<? extends TypeDescription> preMethodTypes,
                          java.util.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 Detail

      • of

        protected static Advice.MethodSizeHandler.ForInstrumentedMethod of​(MethodDescription instrumentedMethod,
                                                                           java.util.List<? extends TypeDescription> initialTypes,
                                                                           java.util.List<? extends TypeDescription> preMethodTypes,
                                                                           java.util.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 - true if 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.
      • requireStackSize

        public void requireStackSize​(int stackSize)
        Records a minimum stack size required by the represented advice method.
        Specified by:
        requireStackSize in interface Advice.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:
        requireLocalVariableLength in interface Advice.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:
        compoundStackSize in interface Advice.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:
        compoundLocalVariableLength in interface Advice.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.