Class Advice.StackMapFrameHandler.Default

    • Field Detail

      • EMPTY

        protected static final java.lang.Object[] EMPTY
        An empty array indicating an empty frame.
      • instrumentedType

        protected final TypeDescription instrumentedType
        The instrumented type.
      • 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.
      • expandFrames

        protected final boolean expandFrames
        true if the meta data handler is expected to expand its frames.
      • currentFrameDivergence

        protected int currentFrameDivergence
        The current frame's size divergence from the original local variable array.
    • Constructor Detail

      • Default

        protected Default​(TypeDescription instrumentedType,
                          MethodDescription instrumentedMethod,
                          java.util.List<? extends TypeDescription> initialTypes,
                          java.util.List<? extends TypeDescription> preMethodTypes,
                          java.util.List<? extends TypeDescription> postMethodTypes,
                          boolean expandFrames)
        Creates a new default stack map frame handler.
        Parameters:
        instrumentedType - The instrumented type.
        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.
        expandFrames - true if the meta data handler is expected to expand its frames.
    • Method Detail

      • of

        protected static Advice.StackMapFrameHandler.ForInstrumentedMethod of​(TypeDescription instrumentedType,
                                                                              MethodDescription instrumentedMethod,
                                                                              java.util.List<? extends TypeDescription> initialTypes,
                                                                              java.util.List<? extends TypeDescription> preMethodTypes,
                                                                              java.util.List<? extends TypeDescription> postMethodTypes,
                                                                              boolean exitAdvice,
                                                                              boolean copyArguments,
                                                                              ClassFileVersion classFileVersion,
                                                                              int writerFlags,
                                                                              int readerFlags)
        Creates an appropriate stack map frame handler for an instrumented method.
        Parameters:
        instrumentedType - The instrumented type.
        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.
        exitAdvice - true if the current advice implies exit advice.
        copyArguments - true if the original arguments are copied before invoking the instrumented method.
        classFileVersion - The instrumented type's class file version.
        writerFlags - The flags supplied to the ASM writer.
        readerFlags - The reader flags supplied to the ASM reader.
        Returns:
        An appropriate stack map frame handler for an instrumented method.
      • translateFrame

        protected void translateFrame​(org.objectweb.asm.MethodVisitor methodVisitor,
                                      Advice.StackMapFrameHandler.Default.TranslationMode translationMode,
                                      MethodDescription methodDescription,
                                      java.util.List<? extends TypeDescription> additionalTypes,
                                      int type,
                                      int localVariableLength,
                                      java.lang.Object[] localVariable,
                                      int stackSize,
                                      java.lang.Object[] stack)
        Translates a frame.
        Parameters:
        methodVisitor - The method visitor to write the frame to.
        translationMode - The translation mode to apply.
        methodDescription - The method description for which the frame is written.
        additionalTypes - The additional types to consider part of the instrumented method's parameters.
        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.
      • injectFullFrame

        protected void injectFullFrame​(org.objectweb.asm.MethodVisitor methodVisitor,
                                       Advice.StackMapFrameHandler.Default.Initialization initialization,
                                       java.util.List<? extends TypeDescription> typesInArray,
                                       java.util.List<? extends TypeDescription> typesOnStack)
        Injects a full stack map frame after the instrumented method has completed.
        Parameters:
        methodVisitor - The method visitor onto which to write the stack map frame.
        initialization - The initialization to apply when resolving a reference to the instance on which a non-static method is invoked.
        typesInArray - The types that were added to the local variable array additionally to the values of the instrumented method.
        typesOnStack - The types currently on the operand stack.