ASTTestTransformation (Groovy 5.1.0)

Package: org.codehaus.groovy.transform

## [Groovy] Class ASTTestTransformation

- org.codehaus.groovy.transform.ASTTestTransformation

- All Implemented Interfaces and Traits:
    ASTTransformation, CompilationUnitAware

      @GroovyASTTransformation(phase: CompilePhase.SEMANTIC_ANALYSIS)
      class ASTTestTransformation
      extends Object
      implements ASTTransformation, CompilationUnitAware

  Implements ASTTest by scheduling the supplied test closure across compilation phases.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `ENABLE_PROPERTY` | System property which, when set to `false`, makes ASTTest a no-op.

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `CompilationUnit` | `compilationUnit` Compilation unit that owns the current transformation.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ASTTestTransformation()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `visit(ASTNode[] nodes, SourceUnit source)` Validates the annotation and schedules execution of its AST assertions.

  - ### Inherited Methods Summary

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

- - ### Field Detail

    - #### public static final String ENABLE_PROPERTY

      System property which, when set to `false`, makes ASTTest a no-op. Compiling source containing the annotation then no longer evaluates its closure. Mirrors the `groovy.grape.enable` switch for `@Grab`.

  - ### Property Detail

    - #### CompilationUnit compilationUnit

      Compilation unit that owns the current transformation.

  - ### Constructor Detail

    - #### ASTTestTransformation()

  - ### Method Detail

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

      Validates the annotation and schedules execution of its AST assertions.

      Does nothing when {

      value:
        #ENABLE_PROPERTY} is set to `false`.
      Parameters:
        `nodes` - the annotation node and annotated AST node
        `source` - the source unit containing the annotation