Class ModifiesEnsuresValidationTransformation

java.lang.Object
org.apache.groovy.contracts.ast.ModifiesEnsuresValidationTransformation
All Implemented Interfaces:
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:

Then simply compares the two metadata sets.
Since:
6.0.0
See Also:
  • Constructor Details

    • ModifiesEnsuresValidationTransformation

      public ModifiesEnsuresValidationTransformation()
  • Method Details

    • visit

      public void visit(ASTNode[] nodes, SourceUnit source)
      Validates that old references used by @Ensures stay within the state declared by @Modifies.
      Specified by:
      visit in interface ASTTransformation
      Parameters:
      nodes - the annotated AST nodes supplied by the compiler
      source - the current source unit