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

## Class Target.Extension

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

Enclosing class:
  Target

    public class Target.Extension
    extends java.lang.Object

A stateful extension of stack or locals space for a target method which can be applied.

Stack and locals extensions are generally localised to a particular injection. This means they don't necessarily need to accumulate, it's generally sufficient to expand the method's original stack or locals size by the extension amount, with the largest extension determining the final stack size of the method.

Before this mechanism, injectors generally needed to keep track of their extension sizes via arbitrary integers, then apply them in one go. However some injector logic made the flow of these integers hard to track and lead to insidious bugs when values which should be combined were instead applied sequentially. The minor performance trade-off of using extensions to track these operations is covered by the increase in robustness.

### Method Summary

All Methods Instance Methods Concrete Methods
`Target.Extension` `add()` Add 1 to this extension
`Target.Extension` `add​(int size)` Add the specified size to this extension
`Target.Extension` `add​(org.objectweb.asm.Type[] types)` Add the size of the supplied type array to this extension.
`void` `apply()` Apply this extension to the target.
`int` `get()` Get the current size of this extension
`Target.Extension` `set​(int size)` Set the size of this extension

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

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

### Method Detail

#### add

    public Target.Extension add()

Add 1 to this extension

Returns:
  fluent interface

#### add

    public Target.Extension add​(int size)

Add the specified size to this extension

Parameters:
  `size` - size to add
Returns:
  fluent interface

#### add

    public Target.Extension add​(org.objectweb.asm.Type[] types)

Add the size of the supplied type array to this extension. The size of the supplied args will first be computed, then the result will be added to the extension.

Parameters:
  `types` - Types to add
Returns:
  fluent interface

#### set

    public Target.Extension set​(int size)

Set the size of this extension

Parameters:
  `size` - Size to set
Returns:
  fluent interface

#### get

    public int get()

Get the current size of this extension

Returns:
  fluent interface

#### apply

    public void apply()

Apply this extension to the target. This reduces the current size to zero so that a new operation can begin if required.