org.codehaus.groovy.transform.powerassert

## Class TruthExpressionRewriter

- java.lang.Object
- - org.codehaus.groovy.transform.powerassert.TruthExpressionRewriter

- All Implemented Interfaces:
    GroovyCodeVisitor

      public class TruthExpressionRewriter
      extends Object
      implements GroovyCodeVisitor

  Rewrites the truth expression of an assertion statement. Implements GroovyCodeVisitor rather than extending from CodeVisitorSupport to make sure that all kinds of expressions are handled.
  Author:
    Peter Niederwieser

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Expression` | `rewrite(Expression truthExpr, SourceText sourceText, AssertionRewriter assertionRewriter)`
    `void` | `visitArgumentlistExpression(ArgumentListExpression expr)`
    `void` | `visitArrayExpression(ArrayExpression expr)`
    `void` | `visitAssertStatement(AssertStatement stat)`
    `void` | `visitAttributeExpression(AttributeExpression expr)`
    `void` | `visitBinaryExpression(BinaryExpression expr)`
    `void` | `visitBitwiseNegationExpression(BitwiseNegationExpression expr)`
    `void` | `visitBlockStatement(BlockStatement stat)`
    `void` | `visitBooleanExpression(BooleanExpression expr)`
    `void` | `visitBreakStatement(BreakStatement stat)`
    `void` | `visitBytecodeExpression(BytecodeExpression expr)`
    `void` | `visitCaseStatement(CaseStatement stat)`
    `void` | `visitCastExpression(CastExpression expr)`
    `void` | `visitCatchStatement(CatchStatement stat)`
    `void` | `visitClassExpression(ClassExpression expr)`
    `void` | `visitClosureExpression(ClosureExpression expr)`
    `void` | `visitClosureListExpression(ClosureListExpression expr)`
    `void` | `visitConstantExpression(ConstantExpression expr)`
    `void` | `visitConstructorCallExpression(ConstructorCallExpression expr)`
    `void` | `visitContinueStatement(ContinueStatement stat)`
    `void` | `visitDeclarationExpression(DeclarationExpression expr)`
    `void` | `visitDoWhileLoop(DoWhileStatement stat)`
    `void` | `visitExpressionStatement(ExpressionStatement stat)`
    `void` | `visitFieldExpression(FieldExpression expr)`
    `void` | `visitForLoop(ForStatement stat)`
    `void` | `visitGStringExpression(GStringExpression expr)`
    `void` | `visitIfElse(IfStatement stat)`
    `void` | `visitListExpression(ListExpression expr)`
    `void` | `visitMapEntryExpression(MapEntryExpression expr)`
    `void` | `visitMapExpression(MapExpression expr)`
    `void` | `visitMethodCallExpression(MethodCallExpression expr)`
    `void` | `visitMethodPointerExpression(MethodPointerExpression expr)`
    `void` | `visitNotExpression(NotExpression expr)`
    `void` | `visitPostfixExpression(PostfixExpression expr)`
    `void` | `visitPrefixExpression(PrefixExpression expr)`
    `void` | `visitPropertyExpression(PropertyExpression expr)`
    `void` | `visitRangeExpression(RangeExpression expr)`
    `void` | `visitRegexExpression(RegexExpression expr)` Deprecated.
    `void` | `visitReturnStatement(ReturnStatement stat)`
    `void` | `visitShortTernaryExpression(ElvisOperatorExpression expr)`
    `void` | `visitSpreadExpression(SpreadExpression expr)`
    `void` | `visitSpreadMapExpression(SpreadMapExpression expr)`
    `void` | `visitStaticMethodCallExpression(StaticMethodCallExpression expr)`
    `void` | `visitSwitch(SwitchStatement stat)`
    `void` | `visitSynchronizedStatement(SynchronizedStatement stat)`
    `void` | `visitTernaryExpression(TernaryExpression expr)`
    `void` | `visitThrowStatement(ThrowStatement stat)`
    `void` | `visitTryCatchFinally(TryCatchStatement stat)`
    `void` | `visitTupleExpression(TupleExpression expr)`
    `void` | `visitUnaryMinusExpression(UnaryMinusExpression expr)`
    `void` | `visitUnaryPlusExpression(UnaryPlusExpression expr)`
    `void` | `visitVariableExpression(VariableExpression expr)`
    `void` | `visitWhileLoop(WhileStatement stat)`

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

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

- - ### Method Detail

    - #### rewrite

          public static Expression rewrite(Expression truthExpr,
                           SourceText sourceText,
                           AssertionRewriter assertionRewriter)

    - #### visitMethodCallExpression

          public void visitMethodCallExpression(MethodCallExpression expr)

      Specified by:
        `visitMethodCallExpression` in interface `GroovyCodeVisitor`

    - #### visitStaticMethodCallExpression

          public void visitStaticMethodCallExpression(StaticMethodCallExpression expr)

      Specified by:
        `visitStaticMethodCallExpression` in interface `GroovyCodeVisitor`

    - #### visitBytecodeExpression

          public void visitBytecodeExpression(BytecodeExpression expr)

      Specified by:
        `visitBytecodeExpression` in interface `GroovyCodeVisitor`

    - #### visitArgumentlistExpression

          public void visitArgumentlistExpression(ArgumentListExpression expr)

      Specified by:
        `visitArgumentlistExpression` in interface `GroovyCodeVisitor`

    - #### visitPropertyExpression

          public void visitPropertyExpression(PropertyExpression expr)

      Specified by:
        `visitPropertyExpression` in interface `GroovyCodeVisitor`

    - #### visitAttributeExpression

          public void visitAttributeExpression(AttributeExpression expr)

      Specified by:
        `visitAttributeExpression` in interface `GroovyCodeVisitor`

    - #### visitFieldExpression

          public void visitFieldExpression(FieldExpression expr)

      Specified by:
        `visitFieldExpression` in interface `GroovyCodeVisitor`

    - #### visitMethodPointerExpression

          public void visitMethodPointerExpression(MethodPointerExpression expr)

      Specified by:
        `visitMethodPointerExpression` in interface `GroovyCodeVisitor`

    - #### visitVariableExpression

          public void visitVariableExpression(VariableExpression expr)

      Specified by:
        `visitVariableExpression` in interface `GroovyCodeVisitor`

    - #### visitDeclarationExpression

          public void visitDeclarationExpression(DeclarationExpression expr)

      Specified by:
        `visitDeclarationExpression` in interface `GroovyCodeVisitor`

    - #### visitRegexExpression

          @Deprecated
          public void visitRegexExpression(RegexExpression expr)

      Deprecated.
      Specified by:
        `visitRegexExpression` in interface `GroovyCodeVisitor`

    - #### visitBinaryExpression

          public void visitBinaryExpression(BinaryExpression expr)

      Specified by:
        `visitBinaryExpression` in interface `GroovyCodeVisitor`

    - #### visitConstantExpression

          public void visitConstantExpression(ConstantExpression expr)

      Specified by:
        `visitConstantExpression` in interface `GroovyCodeVisitor`

    - #### visitClassExpression

          public void visitClassExpression(ClassExpression expr)

      Specified by:
        `visitClassExpression` in interface `GroovyCodeVisitor`

    - #### visitUnaryMinusExpression

          public void visitUnaryMinusExpression(UnaryMinusExpression expr)

      Specified by:
        `visitUnaryMinusExpression` in interface `GroovyCodeVisitor`

    - #### visitUnaryPlusExpression

          public void visitUnaryPlusExpression(UnaryPlusExpression expr)

      Specified by:
        `visitUnaryPlusExpression` in interface `GroovyCodeVisitor`

    - #### visitBitwiseNegationExpression

          public void visitBitwiseNegationExpression(BitwiseNegationExpression expr)

      Specified by:
        `visitBitwiseNegationExpression` in interface `GroovyCodeVisitor`

    - #### visitCastExpression

          public void visitCastExpression(CastExpression expr)

      Specified by:
        `visitCastExpression` in interface `GroovyCodeVisitor`

    - #### visitClosureListExpression

          public void visitClosureListExpression(ClosureListExpression expr)

      Specified by:
        `visitClosureListExpression` in interface `GroovyCodeVisitor`

    - #### visitNotExpression

          public void visitNotExpression(NotExpression expr)

      Specified by:
        `visitNotExpression` in interface `GroovyCodeVisitor`

    - #### visitListExpression

          public void visitListExpression(ListExpression expr)

      Specified by:
        `visitListExpression` in interface `GroovyCodeVisitor`

    - #### visitRangeExpression

          public void visitRangeExpression(RangeExpression expr)

      Specified by:
        `visitRangeExpression` in interface `GroovyCodeVisitor`

    - #### visitMapExpression

          public void visitMapExpression(MapExpression expr)

      Specified by:
        `visitMapExpression` in interface `GroovyCodeVisitor`

    - #### visitMapEntryExpression

          public void visitMapEntryExpression(MapEntryExpression expr)

      Specified by:
        `visitMapEntryExpression` in interface `GroovyCodeVisitor`

    - #### visitConstructorCallExpression

          public void visitConstructorCallExpression(ConstructorCallExpression expr)

      Specified by:
        `visitConstructorCallExpression` in interface `GroovyCodeVisitor`

    - #### visitGStringExpression

          public void visitGStringExpression(GStringExpression expr)

      Specified by:
        `visitGStringExpression` in interface `GroovyCodeVisitor`

    - #### visitArrayExpression

          public void visitArrayExpression(ArrayExpression expr)

      Specified by:
        `visitArrayExpression` in interface `GroovyCodeVisitor`

    - #### visitSpreadExpression

          public void visitSpreadExpression(SpreadExpression expr)

      Specified by:
        `visitSpreadExpression` in interface `GroovyCodeVisitor`

    - #### visitSpreadMapExpression

          public void visitSpreadMapExpression(SpreadMapExpression expr)

      Specified by:
        `visitSpreadMapExpression` in interface `GroovyCodeVisitor`

    - #### visitTernaryExpression

          public void visitTernaryExpression(TernaryExpression expr)

      Specified by:
        `visitTernaryExpression` in interface `GroovyCodeVisitor`

    - #### visitShortTernaryExpression

          public void visitShortTernaryExpression(ElvisOperatorExpression expr)

      Specified by:
        `visitShortTernaryExpression` in interface `GroovyCodeVisitor`

    - #### visitPrefixExpression

          public void visitPrefixExpression(PrefixExpression expr)

      Specified by:
        `visitPrefixExpression` in interface `GroovyCodeVisitor`

    - #### visitPostfixExpression

          public void visitPostfixExpression(PostfixExpression expr)

      Specified by:
        `visitPostfixExpression` in interface `GroovyCodeVisitor`

    - #### visitBooleanExpression

          public void visitBooleanExpression(BooleanExpression expr)

      Specified by:
        `visitBooleanExpression` in interface `GroovyCodeVisitor`

    - #### visitClosureExpression

          public void visitClosureExpression(ClosureExpression expr)

      Specified by:
        `visitClosureExpression` in interface `GroovyCodeVisitor`

    - #### visitTupleExpression

          public void visitTupleExpression(TupleExpression expr)

      Specified by:
        `visitTupleExpression` in interface `GroovyCodeVisitor`

    - #### visitBlockStatement

          public void visitBlockStatement(BlockStatement stat)

      Specified by:
        `visitBlockStatement` in interface `GroovyCodeVisitor`

    - #### visitForLoop

          public void visitForLoop(ForStatement stat)

      Specified by:
        `visitForLoop` in interface `GroovyCodeVisitor`

    - #### visitWhileLoop

          public void visitWhileLoop(WhileStatement stat)

      Specified by:
        `visitWhileLoop` in interface `GroovyCodeVisitor`

    - #### visitDoWhileLoop

          public void visitDoWhileLoop(DoWhileStatement stat)

      Specified by:
        `visitDoWhileLoop` in interface `GroovyCodeVisitor`

    - #### visitIfElse

          public void visitIfElse(IfStatement stat)

      Specified by:
        `visitIfElse` in interface `GroovyCodeVisitor`

    - #### visitExpressionStatement

          public void visitExpressionStatement(ExpressionStatement stat)

      Specified by:
        `visitExpressionStatement` in interface `GroovyCodeVisitor`

    - #### visitReturnStatement

          public void visitReturnStatement(ReturnStatement stat)

      Specified by:
        `visitReturnStatement` in interface `GroovyCodeVisitor`

    - #### visitAssertStatement

          public void visitAssertStatement(AssertStatement stat)

      Specified by:
        `visitAssertStatement` in interface `GroovyCodeVisitor`

    - #### visitTryCatchFinally

          public void visitTryCatchFinally(TryCatchStatement stat)

      Specified by:
        `visitTryCatchFinally` in interface `GroovyCodeVisitor`

    - #### visitSwitch

          public void visitSwitch(SwitchStatement stat)

      Specified by:
        `visitSwitch` in interface `GroovyCodeVisitor`

    - #### visitCaseStatement

          public void visitCaseStatement(CaseStatement stat)

      Specified by:
        `visitCaseStatement` in interface `GroovyCodeVisitor`

    - #### visitBreakStatement

          public void visitBreakStatement(BreakStatement stat)

      Specified by:
        `visitBreakStatement` in interface `GroovyCodeVisitor`

    - #### visitContinueStatement

          public void visitContinueStatement(ContinueStatement stat)

      Specified by:
        `visitContinueStatement` in interface `GroovyCodeVisitor`

    - #### visitThrowStatement

          public void visitThrowStatement(ThrowStatement stat)

      Specified by:
        `visitThrowStatement` in interface `GroovyCodeVisitor`

    - #### visitSynchronizedStatement

          public void visitSynchronizedStatement(SynchronizedStatement stat)

      Specified by:
        `visitSynchronizedStatement` in interface `GroovyCodeVisitor`

    - #### visitCatchStatement

          public void visitCatchStatement(CatchStatement stat)

      Specified by:
        `visitCatchStatement` in interface `GroovyCodeVisitor`