Package org.spongepowered.asm.mixin.injection.struct

## Class Constructor

- java.lang.Object
- - org.spongepowered.asm.mixin.injection.struct.Target
  - - org.spongepowered.asm.mixin.injection.struct.Constructor

- All Implemented Interfaces:
    `java.lang.Comparable<Target>`, `java.lang.Iterable<org.objectweb.asm.tree.AbstractInsnNode>`

      public class Constructor
      extends Target

  A `Target` which is a constructor

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.spongepowered.asm.mixin.injection.struct.Target

      `Target.Extension`

  - ### Field Summary

    - ### Fields inherited from class org.spongepowered.asm.mixin.injection.struct.Target

      `arguments, classInfo, classNode, insns, isStatic, method, returnType`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Constructor​(ClassInfo classInfo, org.objectweb.asm.tree.ClassNode classNode, org.objectweb.asm.tree.MethodNode method)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Bytecode.DelegateInitialiser` | `findDelegateInitNode()` | Find the call to `super()` or `this()` in a constructor.
    `org.objectweb.asm.tree.AbstractInsnNode` | `findFirstBodyInsn()` | Find the injection point
    `org.objectweb.asm.tree.AbstractInsnNode` | `findInitialiserInjectionPoint​(Initialiser.InjectionMode mode)` | Find the injection point for injected initialiser insns in the target ctor.
    `static InsnRange` | `getRange​(org.objectweb.asm.tree.MethodNode ctor)` | Identifies line numbers in the supplied ctor which correspond to the start and end of the method body.
    `void` | `inspect​(Initialiser initialiser)` | Inspect an incoming initialiser to determine which fields are touched by the mixin.
    `boolean` | `isInjectable()` | Get whether this constructor should have mixin initialisers injected into it based on whether a delegate initialiser call is absent or is a call to super()

    - ### Methods inherited from class org.spongepowered.asm.mixin.injection.struct.Target

      `addInjectionNode, addLocalVariable, addLocalVariable, allocateLocal, allocateLocals, compareTo, extendLocals, extendStack, findInitNodeFor, findInitNodeFor, generateArgMap, generateArgMap, get, getArgIndices, getCallbackDescriptor, getCallbackDescriptor, getCallbackInfoClass, getCurrentMaxLocals, getCurrentMaxStack, getDesc, getInjectionNode, getMaxLocals, getMaxStack, getName, getSignature, getSimpleCallbackDescriptor, indexOf, indexOf, insert, insert, insert, insert, insertBefore, insertBefore, insertBefore, insertBefore, iterator, of, removeNode, replaceNode, replaceNode, replaceNode, toString, wrapNode`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### Constructor

          public Constructor​(ClassInfo classInfo,
                             org.objectweb.asm.tree.ClassNode classNode,
                             org.objectweb.asm.tree.MethodNode method)

  - ### Method Detail

    - #### findDelegateInitNode

          public Bytecode.DelegateInitialiser findDelegateInitNode()

      Find the call to `super()` or `this()` in a constructor. This attempts to locate the first call to `<init>` which isn't an inline call to another object ctor being passed into the super invocation.
      Returns:
        Call to `super()`, `this()` or `DelegateInitialiser.NONE` if not found

    - #### isInjectable

          public boolean isInjectable()

      Get whether this constructor should have mixin initialisers injected into it based on whether a delegate initialiser call is absent or is a call to super()

    - #### inspect

          public void inspect​(Initialiser initialiser)

      Inspect an incoming initialiser to determine which fields are touched by the mixin. This is then used in `findInitialiserInjectionPoint(org.spongepowered.asm.mixin.transformer.struct.Initialiser.InjectionMode)` to determine the instruction after which the mixin initialisers will be placed
      Parameters:
        `initialiser` - the initialiser to inspect

    - #### findInitialiserInjectionPoint

          public org.objectweb.asm.tree.AbstractInsnNode findInitialiserInjectionPoint​(Initialiser.InjectionMode mode)

      Find the injection point for injected initialiser insns in the target ctor. This starts by assuming that initialiser instructions should be placed immediately after the delegate initialiser call, but then searches for field assignments and selects the last unique field assignment in the ctor body which represents a reasonable heuristic for the end of the existing initialisers.
      Parameters:
        `mode` - Injection mode for this specific environment
      Returns:
        target node

    - #### findFirstBodyInsn

          public org.objectweb.asm.tree.AbstractInsnNode findFirstBodyInsn()

      Find the injection point

    - #### getRange

          public static InsnRange getRange​(org.objectweb.asm.tree.MethodNode ctor)

      Identifies line numbers in the supplied ctor which correspond to the start and end of the method body.
      Parameters:
        `ctor` - constructor to scan
      Returns:
        range indicating the line numbers of the specified constructor and the position of the superclass ctor invocation