onModify
open fun onModify(key: String, sig: MethodType, self: Any, args: Array<Any>, returned: Any, thrown: Throwable): Any
Return-side decision, after the body ran. The value returned is always assigned, so "leave it alone" is spelled by handing returned straight back — that is what makes replacing it with null expressible.
Return
the method's new return value
Parameters
key
the patch key that fired
sig
the patched method's signature; only its return type matters here
self
the receiver (null for static methods)
args
the argument slots as they stand at exit, boxed
returned
the return value, boxed; null for void and meaningless when thrown is non-null
thrown
the exception leaving the method, or null on a normal return. Assigning a return value does NOT suppress it — a throwing method still throws