Class CallbackInjector

java.lang.Object
org.spongepowered.asm.mixin.injection.code.Injector
org.spongepowered.asm.mixin.injection.callback.CallbackInjector

public class CallbackInjector extends Injector
This class is responsible for generating the bytecode for injected callbacks, for details of usage see @Inject.
  • Constructor Details

    • CallbackInjector

      public CallbackInjector(InjectionInfo info, boolean cancellable, LocalCapture localCapture, String identifier)
      Make a new CallbackInjector with the supplied args
      Parameters:
      info - information about this injector
      cancellable - True if injections performed by this injector should be cancellable
      localCapture - Local variable capture behaviour
  • Method Details

    • sanityCheck

      protected void sanityCheck(Target target, List<InjectionPoint> injectionPoints)
      Overrides:
      sanityCheck in class Injector
    • addTargetNode

      protected void addTargetNode(InjectorTarget injectorTarget, List<InjectionNodes.InjectionNode> myNodes, org.objectweb.asm.tree.AbstractInsnNode node, Set<InjectionPoint> nominators)
      Overrides:
      addTargetNode in class Injector
    • preInject

      protected void preInject(Target target, InjectionNodes.InjectionNode node)
      Overrides:
      preInject in class Injector
    • inject

      protected void inject(Target target, InjectionNodes.InjectionNode node)
      Specified by:
      inject in class Injector
    • instanceCallbackInfo

      protected void instanceCallbackInfo(org.spongepowered.asm.mixin.injection.callback.CallbackInjector.Callback callback, String id, String desc, boolean store)
      Parameters:
      callback - callback handle
      id - callback id
      desc - constructor descriptor
      store - true if storing in a local, false if this is happening at an invoke
    • injectCancellationCode

      protected void injectCancellationCode(org.spongepowered.asm.mixin.injection.callback.CallbackInjector.Callback callback)
      if (e.isCancelled()) return e.getReturnValue();
      Parameters:
      callback - callback handle
    • injectReturnCode

      protected void injectReturnCode(org.spongepowered.asm.mixin.injection.callback.CallbackInjector.Callback callback)
      Inject the appropriate return code for the method type
      Parameters:
      callback - callback handle
    • isStatic

      protected boolean isStatic()
      Explicit to avoid creation of synthetic accessor
      Returns:
      true if the target method is static