Interface StaticRewrite

All Superinterfaces:
MethodRewriteRule, RewriteRule
All Known Subinterfaces:
GeneratedStaticRewrite, TargetedTypeGeneratedStaticRewrite, TargetedTypeGeneratedStaticRewrite.Parameter, TargetedTypeGeneratedStaticRewrite.Return
All Known Implementing Classes:
DirectParameterRewrite, DirectReturnRewrite, DirectStaticRewrite, FuzzyParameterRewrite, MoveInstanceMethod

public interface StaticRewrite extends MethodRewriteRule
  • Field Details

  • Method Details

    • staticRedirectOwner

      ClassDesc staticRedirectOwner(ClassProcessingContext context)
    • transformToRedirectDescriptor

      default MethodTypeDesc transformToRedirectDescriptor(MethodTypeDesc intermediateDescriptor)
      Transforms the intermediate descriptor to the final descriptor that will be used in the rewritten bytecode.

      Intermediate means that it has been modified from the original accounting for the virtual/interface/static/constructor-ness of the method call.

      Parameters:
      intermediateDescriptor - the intermediate descriptor
      Returns:
      the final descriptor to be used in the rewritten bytecode
    • createRewrite

      default MethodRewrite<GeneratedMethodHolder.MethodCallData> createRewrite(ClassProcessingContext context, MethodTypeDesc intermediateDescriptor, GeneratedMethodHolder.MethodCallData originalCallData)
      Creates a rewrite for the given method call data.
      Parameters:
      context - the context
      intermediateDescriptor - the descriptor modified from the original to account for the method call type (interface, virtual, static, etc.)
      originalCallData - the original method call data
      Returns:
      the rewrite
    • createConstructorRewrite

      default MethodRewrite<GeneratedMethodHolder.ConstructorCallData> createConstructorRewrite(ClassProcessingContext context, MethodTypeDesc intermediateDescriptor, GeneratedMethodHolder.ConstructorCallData originalCallData)
      Creates a rewrite for the given constructor call data.
      Parameters:
      context - the context
      intermediateDescriptor - the descriptor modified from the original to include a return type
      originalCallData - the original constructor call data
      Returns:
      the rewrite
    • rewrite

      default @Nullable MethodRewrite<?> rewrite(ClassProcessingContext context, boolean isInvokeDynamic, int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface)
      Description copied from interface: MethodRewriteRule
      Creates a MethodRewrite which will be applied to the processed bytecode.
      Specified by:
      rewrite in interface MethodRewriteRule
      Parameters:
      context - the current context
      isInvokeDynamic - if this is in an invokedynamic instruction
      opcode - the opcode of the invoke instruction or the invokedynamic handle tag
      owner - the owner of the invoke method or the owner of the invokedynamic handle
      name - the name of the invoke method or the name of the invokedynamic handle
      descriptor - the descriptor of the invoke method or the descriptor of the invokedynamic handle
      isInterface - if the method is an interface method
      Returns:
      the rewrite or null if no rewrite should be applied