Package org.spongepowered.asm.mixin.injection.points

## Class BeforeReturn

- java.lang.Object
- - org.spongepowered.asm.mixin.injection.InjectionPoint
  - - org.spongepowered.asm.mixin.injection.points.BeforeReturn

-     public class BeforeReturn
      extends InjectionPoint

  This injection point searches for RETURN opcodes in the target method and returns a list of insns immediately prior to matching instructions. Note that every RETURN opcode will be returned and thus every natural exit from the method except for exception throws will be implicitly specified. To specify a particular RETURN use the ordinal parameter. The injection point accepts the following parameters from `At`:

  ordinal
    The ordinal position of the RETURN opcode to match, if not specified then the injection point returns all RETURN opcodes. For example if the RETURN opcode appears 3 times in the method and you want to match the 3rd then you can specify an ordinal of 2 (ordinals are zero-indexed). The default value is -1 which supresses ordinal matching

  Example:

  >        @At(value = "RETURN")

  Note that if value is the only parameter specified, it can be omitted:

  >        @At("RETURN")

- - ### Nested Class Summary

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

      `InjectionPoint.AtCode, InjectionPoint.Flags, InjectionPoint.RestrictTargetLevel, InjectionPoint.Specifier`

  - ### Field Summary

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

      `DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BeforeReturn​(InjectionPointData data)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `checkPriority​(int targetPriority, int ownerPriority)` | Runs a priority check in the context of this injection point.
    `boolean` | `find​(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)` | Find injection points in the supplied insn list
    `InjectionPoint.RestrictTargetLevel` | `getTargetRestriction​(IInjectionPointContext context)` | Returns the target restriction level for this injection point.

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

      `addMessage, after, and, before, getAtCode, getId, getSlice, getSpecifier, nextNode, or, parse, parse, parse, parse, parse, parse, parse, parse, register, register, setTargetRestriction, shift, toString`

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

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

- - ### Constructor Detail

    - #### BeforeReturn

          public BeforeReturn​(InjectionPointData data)

  - ### Method Detail

    - #### checkPriority

          public boolean checkPriority​(int targetPriority,
                                       int ownerPriority)

      Description copied from class: `InjectionPoint`
      Runs a priority check in the context of this injection point. A priority check should return `true` if the injection point is allowed to inject given the relative priorities of the target (a method merged by another mixin with `targetPriority`) and the incoming mixin with priority `mixinPriority`.
      Overrides:
        `checkPriority` in class `InjectionPoint`
      Parameters:
        `targetPriority` - Priority of the mixin which originally merged the target method in question
        `ownerPriority` - Priority of the mixin which owns the owning injector
      Returns:
        true if the priority check succeeds

    - #### getTargetRestriction

          public InjectionPoint.RestrictTargetLevel getTargetRestriction​(IInjectionPointContext context)

      Description copied from class: `InjectionPoint`
      Returns the target restriction level for this injection point. This level defines whether an injection point is valid in its current state when being used by a restricted injector (currently `CallbackInjector`).
      Overrides:
        `getTargetRestriction` in class `InjectionPoint`
      Parameters:
        `context` - injection-specific context
      Returns:
        restriction level

    - #### find

          public boolean find​(java.lang.String desc,
                              org.objectweb.asm.tree.InsnList insns,
                              java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)

      Description copied from class: `InjectionPoint`
      Find injection points in the supplied insn list
      Specified by:
        `find` in class `InjectionPoint`
      Parameters:
        `desc` - Method descriptor, supplied to allow return types and arguments etc. to be determined
        `insns` - Insn list to search in, the strategy MUST ONLY add nodes from this list to the `nodes` collection
        `nodes` - Collection of nodes to populate. Injectors should NOT make any assumptions about the state of this collection and should only call the add() method
      Returns:
        true if one or more injection points were found