public class MethodVariantASTTransformation
extends Object
implements ASTTransformation
Handles a Decreases annotation placed on a method (the loop case is handled by LoopVariantASTTransformation). The closure is a termination measure over the method's parameters that must strictly decrease, and stay non-negative, on every recursive re-entry.
The method body is wrapped so that, conceptually:
def $m = <measure>
def $prev = MethodVariantSupport.enter("<key>", $m) // checks decrease vs the enclosing frame
try { <original body> } finally { MethodVariantSupport.exit("<key>", $prev) }
The check is pure entry/exit bookkeeping keyed by method signature, so no
static analysis of recursive call sites is needed.