Class Target.Extension
- Enclosing class:
Target
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
Modifier and TypeMethodDescriptionadd()Add 1 to this extensionadd(int size) Add the specified size to this extensionadd(org.objectweb.asm.Type[] types) Add the size of the supplied type array to this extension.voidapply()Apply this extension to the target.intget()Get the current size of this extensionset(int size) Set the size of this extension
-
Method Details
-
add
Add 1 to this extension- Returns:
- fluent interface
-
add
Add the specified size to this extension- Parameters:
size- size to add- Returns:
- fluent interface
-
add
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
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.
-