org.codehaus.groovy.control

## Class ResolveVisitor

- java.lang.Object
- - org.codehaus.groovy.ast.CodeVisitorSupport
  - - org.codehaus.groovy.ast.ClassCodeVisitorSupport
    - - org.codehaus.groovy.ast.ClassCodeExpressionTransformer
      - - org.codehaus.groovy.control.ResolveVisitor

- All Implemented Interfaces:
    ExpressionTransformer, GroovyClassVisitor, GroovyCodeVisitor
  Direct Known Subclasses:
    JavaAwareResolveVisitor

      public class ResolveVisitor
      extends ClassCodeExpressionTransformer

  Visitor to resolve Types and convert VariableExpression to ClassExpressions if needed. The ResolveVisitor will try to find the Class for a ClassExpression and prints an error if it fails to do so. Constructions like C[], foo as C, (C) foo will force creation of a ClassExpression for C

  Note: the method to start the resolving is startResolving(ClassNode, SourceUnit).
  Author:
    Jochen Theodorou, Roshan Dawrani, Alex Tkachman

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String[]` | `DEFAULT_IMPORTS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResolveVisitor(CompilationUnit cu)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected SourceUnit` | `getSourceUnit()`
    `void` | `startResolving(ClassNode node, SourceUnit source)`
    `Expression` | `transform(Expression exp)` Transforms the given expression into another expression
    `protected Expression` | `transformAnnotationConstantExpression(AnnotationConstantExpression ace)`
    `protected Expression` | `transformBinaryExpression(BinaryExpression be)`
    `protected Expression` | `transformClosureExpression(ClosureExpression ce)`
    `protected Expression` | `transformConstructorCallExpression(ConstructorCallExpression cce)`
    `protected Expression` | `transformDeclarationExpression(DeclarationExpression de)`
    `protected Expression` | `transformMethodCallExpression(MethodCallExpression mce)`
    `protected Expression` | `transformPropertyExpression(PropertyExpression pe)`
    `protected Expression` | `transformVariableExpression(VariableExpression ve)`
    `void` | `visitAnnotations(AnnotatedNode node)`
    `void` | `visitBlockStatement(BlockStatement block)`
    `void` | `visitCatchStatement(CatchStatement cs)`
    `void` | `visitClass(ClassNode node)`
    `protected void` | `visitConstructorOrMethod(MethodNode node, boolean isConstructor)`
    `void` | `visitField(FieldNode node)`
    `void` | `visitForLoop(ForStatement forLoop)`
    `void` | `visitProperty(PropertyNode node)`

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

      `visitAssertStatement, visitCaseStatement, visitDoWhileLoop, visitExpressionStatement, visitIfElse, visitReturnStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitWhileLoop`

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

      `addError, visitBreakStatement, visitClassCodeContainer, visitConstructor, visitContinueStatement, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitStatement, visitTryCatchFinally, visitVariableExpression`

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

      `visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureExpression, 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`

- - ### Field Detail

    - #### DEFAULT_IMPORTS

          public static final String[] DEFAULT_IMPORTS

  - ### Constructor Detail

    - #### ResolveVisitor

          public ResolveVisitor(CompilationUnit cu)

  - ### Method Detail

    - #### startResolving

          public void startResolving(ClassNode node,
                            SourceUnit source)

    - #### visitConstructorOrMethod

          protected void visitConstructorOrMethod(MethodNode node,
                                      boolean isConstructor)

      Overrides:
        `visitConstructorOrMethod` in class `ClassCodeExpressionTransformer`

    - #### visitField

          public void visitField(FieldNode node)

      Specified by:
        `visitField` in interface `GroovyClassVisitor`
      Overrides:
        `visitField` in class `ClassCodeExpressionTransformer`

    - #### visitProperty

          public void visitProperty(PropertyNode node)

      Specified by:
        `visitProperty` in interface `GroovyClassVisitor`
      Overrides:
        `visitProperty` in class `ClassCodeExpressionTransformer`

    - #### transform

          public Expression transform(Expression exp)

      Description copied from interface: `ExpressionTransformer`
      Transforms the given expression into another expression
      Specified by:
        `transform` in interface `ExpressionTransformer`
      Overrides:
        `transform` in class `ClassCodeExpressionTransformer`

    - #### transformPropertyExpression

          protected Expression transformPropertyExpression(PropertyExpression pe)

    - #### transformVariableExpression

          protected Expression transformVariableExpression(VariableExpression ve)

    - #### transformBinaryExpression

          protected Expression transformBinaryExpression(BinaryExpression be)

    - #### transformClosureExpression

          protected Expression transformClosureExpression(ClosureExpression ce)

    - #### transformConstructorCallExpression

          protected Expression transformConstructorCallExpression(ConstructorCallExpression cce)

    - #### transformMethodCallExpression

          protected Expression transformMethodCallExpression(MethodCallExpression mce)

    - #### transformDeclarationExpression

          protected Expression transformDeclarationExpression(DeclarationExpression de)

    - #### transformAnnotationConstantExpression

          protected Expression transformAnnotationConstantExpression(AnnotationConstantExpression ace)

    - #### visitAnnotations

          public void visitAnnotations(AnnotatedNode node)

      Overrides:
        `visitAnnotations` in class `ClassCodeExpressionTransformer`

    - #### visitClass

          public void visitClass(ClassNode node)

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

    - #### visitCatchStatement

          public void visitCatchStatement(CatchStatement cs)

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

    - #### visitForLoop

          public void visitForLoop(ForStatement forLoop)

      Specified by:
        `visitForLoop` in interface `GroovyCodeVisitor`
      Overrides:
        `visitForLoop` in class `ClassCodeExpressionTransformer`

    - #### visitBlockStatement

          public void visitBlockStatement(BlockStatement block)

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

    - #### getSourceUnit

          protected SourceUnit getSourceUnit()

      Specified by:
        `getSourceUnit` in class `ClassCodeVisitorSupport`