org.codehaus.groovy.transform.powerassert

## Class AssertionRewriter

- java.lang.Object
- - org.codehaus.groovy.ast.CodeVisitorSupport
  - - org.codehaus.groovy.ast.ClassCodeVisitorSupport
    - - org.codehaus.groovy.transform.powerassert.StatementReplacingVisitorSupport
      - - org.codehaus.groovy.transform.powerassert.AssertionRewriter

- All Implemented Interfaces:
    GroovyClassVisitor, GroovyCodeVisitor

      public class AssertionRewriter
      extends StatementReplacingVisitorSupport

  Rewrites all assertions in a source unit.
  Author:
    Peter Niederwieser

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected SourceUnit` | `getSourceUnit()`
    `static void` | `rewrite(SourceUnit sourceUnit)` Rewrites all assertions in the given source unit.
    `void` | `visitAssertStatement(AssertStatement stat)`
    `void` | `visitClass(ClassNode node)`
    `void` | `visitClosureExpression(ClosureExpression expr)`
    `void` | `visitConstructor(ConstructorNode constructor)`
    `void` | `visitMethod(MethodNode method)`

    - ### Methods inherited from class org.codehaus.groovy.transform.powerassert.StatementReplacingVisitorSupport

      `replace, replaceAll, replaceVisitedStatementWith, visitBlockStatement, visitCaseStatement, visitCatchStatement, visitDoWhileLoop, visitForLoop, visitIfElse, visitSwitch, visitSynchronizedStatement, visitTryCatchFinally, visitWhileLoop`

    - ### Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport

      `addError, visitAnnotations, visitBreakStatement, visitClassCodeContainer, visitConstructorOrMethod, visitContinueStatement, visitExpressionStatement, visitField, visitImports, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitThrowStatement, visitVariableExpression`

    - ### Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport

      `visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitDeclarationExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitRegexExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression`

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

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

- - ### Method Detail

    - #### rewrite

          public static void rewrite(SourceUnit sourceUnit)

      Rewrites all assertions in the given source unit.
      Parameters:
        `sourceUnit` - a source unit

    - #### visitClass

          public void visitClass(ClassNode node)

      Specified by:
        `visitClass` in interface `GroovyClassVisitor`
      Overrides:
        `visitClass` in class `ClassCodeVisitorSupport`

    - #### visitConstructor

          public void visitConstructor(ConstructorNode constructor)

      Specified by:
        `visitConstructor` in interface `GroovyClassVisitor`
      Overrides:
        `visitConstructor` in class `ClassCodeVisitorSupport`

    - #### visitMethod

          public void visitMethod(MethodNode method)

      Specified by:
        `visitMethod` in interface `GroovyClassVisitor`
      Overrides:
        `visitMethod` in class `ClassCodeVisitorSupport`

    - #### visitClosureExpression

          public void visitClosureExpression(ClosureExpression expr)

      Specified by:
        `visitClosureExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitClosureExpression` in class `CodeVisitorSupport`

    - #### visitAssertStatement

          public void visitAssertStatement(AssertStatement stat)

      Specified by:
        `visitAssertStatement` in interface `GroovyCodeVisitor`
      Overrides:
        `visitAssertStatement` in class `ClassCodeVisitorSupport`

    - #### getSourceUnit

          protected SourceUnit getSourceUnit()

      Specified by:
        `getSourceUnit` in class `ClassCodeVisitorSupport`