Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 510 Bytes

modify-variable.md

File metadata and controls

30 lines (23 loc) · 510 Bytes

@ModifyVariable

<- Return

Modifies a local variable.

Parameters: the target variable

Return type: the target variable's type

Example mixin:

@ModifyVariable(
    method = "target()V",
    at = @At(value = "INVOKE_ASSIGN", target = "Lnet/example/Dummy;dummy()D"),
    index = 1
)
private double mixin(double original) {
    return 1.0;
}

Method modification:

  public void target() {
      double original = Dummy.getInstance().dummy();
+     original = 1.0;
  }