Package: org.apache.groovy.contracts.ast

## [Java] Class ModifiesEnsuresValidationTransformation

- org.apache.groovy.contracts.ast.ModifiesEnsuresValidationTransformation

- All Implemented Interfaces and Traits:
    ASTTransformation

      public class ModifiesEnsuresValidationTransformation
      extends Object
      implements ASTTransformation

  Validates that `@Ensures` postconditions on a method only reference fields via `old.xxx` that are declared as modifiable by `@Modifies`.

  Runs at CompilePhase.INSTRUCTION_SELECTION after both:

  - ModifiesASTTransformation has stored the modification set, and
  - AnnotationClosureVisitor has recorded the `old` references
  Then simply compares the two metadata sets.
  Since:
    6.0.0
  See Also:
    Modifies

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `visit(ASTNode[] nodes, SourceUnit source)` Validates that `old` references used by `@Ensures` stay within the state declared by `@Modifies`.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### public void visit(ASTNode[] nodes, SourceUnit source)

      Validates that `old` references used by `@Ensures` stay within the state declared by `@Modifies`.

      Parameters:
        `nodes` - the annotated AST nodes supplied by the compiler
        `source` - the current source unit