Interface Advice.PostProcessor

All Known Implementing Classes:
Advice.AssignReturned, Advice.AssignReturned.ForArray, Advice.AssignReturned.ForScalar, Advice.PostProcessor.Compound, Advice.PostProcessor.NoOp
Enclosing class:
Advice

public static interface Advice.PostProcessor

A post processor for advice methods that is invoked after advice is executed. A post processor is invoked after the instrumented method and only after a regular completion of the method. When invoked, the advice method's return value is stored in the local variable array. Upon completion, the local variable array must still be intact and the stack must be empty. A frame is added subsequently to the post processor's execution, making it feasible to add a jump instruction to the end of the method after which no further byte code instructions must be issued. This also applies to compound post processors. If a post processor emits a frame as its last instruction, it should yield a NOP instruction to avoid that subsequent code starts with a frame.

Important: A post processor is triggered after the suppression handler. Exceptions triggered by post processing code will therefore cause those exceptions to be propagated unless the post processor configures explicit exception handling.

  • Method Details

    • resolve

      StackManipulation resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.ArgumentHandler argumentHandler, Advice.StackMapFrameHandler.ForPostProcessor stackMapFrameHandler, StackManipulation exceptionHandler)
      Resolves this post processor for a given instrumented method.
      Parameters:
      instrumentedType - The instrumented type.
      instrumentedMethod - The instrumented method.
      assigner - The assigner to use.
      argumentHandler - The argument handler to use.
      stackMapFrameHandler - The argument handler for the instrumented method.
      exceptionHandler - The exception handler that is resolved for the instrumented method.
      Returns:
      The stack manipulation to apply.