Package org.apache.groovy.contracts.ast

# Class ModifiesASTTransformation

java.lang.Object
org.apache.groovy.contracts.ast.ModifiesASTTransformation

All Implemented Interfaces:
  `ASTTransformation`

public class ModifiesASTTransformation extends Object implements ASTTransformation
Handles `Modifies` annotations placed on methods. Extracts the declared modification targets (fields and parameters) from the annotation closure and stores them as node metadata on the `MethodNode`.

The metadata key is "groovy.contracts.modifiesFields" and the value is a `Set<String>` of field/parameter names. Downstream processors (such as `@Ensures` validation) can read this metadata.

Since:
  6.0.0
See Also:
  - `Modifies`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `MODIFIES_FIELDS_KEY`
  Node metadata key for the set of modifiable field/parameter names.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ModifiesASTTransformation()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `visit(ASTNode[] nodes, SourceUnit source)`
  Extracts the modifiable targets declared by `@Modifies` and stores them as method metadata.

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

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

- ## Field Details

  - ### MODIFIES_FIELDS_KEY

    public static final String MODIFIES_FIELDS_KEY
    Node metadata key for the set of modifiable field/parameter names.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ModifiesASTTransformation

    public ModifiesASTTransformation()

- ## Method Details

  - ### visit

    public void visit(ASTNode[] nodes, SourceUnit source)
    Extracts the modifiable targets declared by `@Modifies` and stores them as method metadata.
    Specified by:
      `visit` in interface `ASTTransformation`
    Parameters:
      `nodes` - the annotated AST nodes supplied by the compiler
      `source` - the current source unit