Package org.codehaus.groovy.transform.stc

## Class StaticTypeCheckingVisitor

- java.lang.Object
- - org.codehaus.groovy.ast.CodeVisitorSupport
  - - org.codehaus.groovy.ast.ClassCodeVisitorSupport
    - - org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor

- All Implemented Interfaces:
    `GroovyClassVisitor`, `GroovyCodeVisitor`, `ErrorCollecting`
  Direct Known Subclasses:
    `StaticCompilationVisitor`

      public class StaticTypeCheckingVisitor
      extends ClassCodeVisitorSupport

  The main class code visitor responsible for static type checking. It will perform various inspections like checking assignment types, type inference, ... Eventually, class nodes may be annotated with inferred type information.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `StaticTypeCheckingVisitor.SignatureCodecFactory` |
    `protected class` | `StaticTypeCheckingVisitor.VariableExpressionTypeMemoizer` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static MethodNode` | `CLOSURE_CALL_NO_ARG` |
    `static MethodNode` | `CLOSURE_CALL_ONE_ARG` |
    `static MethodNode` | `CLOSURE_CALL_VARGS` |
    `protected static ClassNode` | `CLOSUREPARAMS_CLASSNODE` |
    `protected static Expression` | `CURRENT_SIGNATURE_PROTOCOL` |
    `protected static int` | `CURRENT_SIGNATURE_PROTOCOL_VERSION` |
    `protected FieldNode` | `currentField` |
    `protected PropertyNode` | `currentProperty` |
    `protected static ClassNode` | `DELEGATES_TO` |
    `protected static ClassNode` | `DELEGATES_TO_TARGET` |
    `protected static ClassNode` | `DGM_CLASSNODE` |
    `protected static List<MethodNode>` | `EMPTY_METHODNODE_LIST` |
    `protected static ClassNode` | `ENUMERATION_TYPE` |
    `protected static Object` | `ERROR_COLLECTOR` |
    `protected DefaultTypeCheckingExtension` | `extension` |
    `static Statement` | `GENERATED_EMPTY_STATEMENT` |
    `protected static MethodNode` | `GET_DELEGATE` |
    `protected static MethodNode` | `GET_OWNER` |
    `protected static MethodNode` | `GET_THISOBJECT` |
    `protected static ClassNode` | `ITERABLE_TYPE` |
    `protected static ClassNode` | `LINKEDHASHMAP_CLASSNODE` |
    `protected static ClassNode` | `MAP_ENTRY_TYPE` |
    `protected static ClassNode` | `NAMED_PARAMS_CLASSNODE` |
    `protected ReturnAdder` | `returnAdder` |
    `protected ReturnAdder.ReturnStatementListener` | `returnListener` |
    `protected static ClassNode` | `TYPECHECKED_CLASSNODE` |
    `protected static ClassNode[]` | `TYPECHECKING_ANNOTATIONS` |
    `protected static ClassNode` | `TYPECHECKING_INFO_NODE` |
    `protected TypeCheckingContext` | `typeCheckingContext` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StaticTypeCheckingVisitor​(SourceUnit source, ClassNode classNode)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `addAmbiguousErrorMessage​(List<MethodNode> foundMethods, String name, ClassNode[] args, Expression expr)` |
    `protected void` | `addAssignmentError​(ClassNode leftType, ClassNode rightType, Expression assignmentExpression)` |
    `protected void` | `addCategoryMethodCallError​(Expression call)` |
    `protected void` | `addClosureReturnType​(ClassNode returnType)` |
    `void` | `addError​(String msg, ASTNode expr)` |
    `protected void` | `addNoMatchingMethodError​(ClassNode receiver, String name, ClassNode[] args, Expression call)` |
    `protected void` | `addReceivers​(List<Receiver<String>> receivers, Collection<Receiver<String>> owners, boolean implicitThis)` |
    `protected void` | `addStaticTypeError​(String msg, ASTNode expr)` |
    `void` | `addTypeCheckingExtension​(TypeCheckingExtension extension)` |
    `protected void` | `addTypeCheckingInfoAnnotation​(MethodNode node)` |
    `protected void` | `addUnsupportedPreOrPostfixExpressionError​(Expression expression)` |
    `protected boolean` | `areCategoryMethodCalls​(List<MethodNode> foundMethods, String name, ClassNode[] args)` |
    `protected boolean` | `checkCast​(ClassNode targetType, Expression source)` |
    `protected void` | `checkClosureParameters​(Expression callArguments, ClassNode receiver)` | Deprecated. this method is unused, replaced with `DelegatesTo` inference.
    `protected void` | `checkForbiddenSpreadArgument​(ArgumentListExpression argumentList)` |
    `protected void` | `checkGroovyConstructorMap​(Expression receiver, ClassNode receiverType, MapExpression mapExpression)` |
    `protected void` | `checkGroovyStyleConstructor​(ClassNode node, ClassNode[] arguments)` | Deprecated. use `checkGroovyStyleConstructor(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.ClassNode[], org.codehaus.groovy.ast.ASTNode)` )}
    `protected MethodNode` | `checkGroovyStyleConstructor​(ClassNode node, ClassNode[] arguments, ASTNode source)` | Checks that a constructor style expression is valid regarding the number of arguments and the argument types.
    `protected ClassNode` | `checkReturnType​(ReturnStatement statement)` |
    `protected void` | `collectAllInterfaceMethodsByName​(ClassNode type, String name, List<MethodNode> methods)` |
    `protected boolean` | `existsProperty​(PropertyExpression pexp, boolean checkForReadOnly)` |
    `protected boolean` | `existsProperty​(PropertyExpression pexp, boolean readMode, ClassCodeVisitorSupport visitor)` | Checks whether a property exists on the receiver, or on any of the possible receiver classes (found in the temporary type information table)
    `static String` | `extractPropertyNameFromMethodName​(String prefix, String methodName)` | Given a method name and a prefix, returns the name of the property that should be looked up, following the java beans rules.
    `protected Object` | `extractTemporaryTypeInfoKey​(Expression expression)` | When instanceof checks are found in the code, we store temporary type information data in the `TypeCheckingContext.temporaryIfBranchTypeInformation` table.
    `protected static ClassNode[]` | `extractTypesFromParameters​(Parameter[] parameters)` |
    `protected ClassNode` | `findCurrentInstanceOfClass​(Expression expr, ClassNode type)` | A helper method which determines which receiver class should be used in error messages when a field or attribute is not found.
    `BinaryExpression` | `findInstanceOfNotReturnExpression​(IfStatement ifElse)` | Check IfStatement matched pattern : Object var1; if (!(var1 instanceOf Runnable)){ return } // Here var1 instance of Runnable
    `protected List<MethodNode>` | `findMethod​(ClassNode receiver, String name, ClassNode... args)` |
    `protected MethodNode` | `findMethodOrFail​(Expression expr, ClassNode receiver, String name, ClassNode... args)` |
    `protected List<MethodNode>` | `findMethodsWithGenerated​(ClassNode receiver, String name)` | This method returns the list of methods named against the supplied parameter that are defined on the specified receiver, but it will also add "non existing" methods that will be generated afterwards by the compiler, for example if a method is using default values and that the specified class node isn't compiled yet.
    `protected static String` | `formatArgumentList​(ClassNode[] nodes)` |
    `protected ClassNode[]` | `getArgumentTypes​(ArgumentListExpression args)` |
    `protected org.codehaus.groovy.transform.stc.DelegationMetadata` | `getDelegationMetadata​(ClosureExpression expression)` |
    `protected static ClassNode` | `getGroupOperationResultType​(ClassNode a, ClassNode b)` |
    `protected ClassNode` | `getInferredReturnType​(ASTNode exp)` | Returns the inferred return type of a closure or a method, if stored on the AST node.
    `protected ClassNode` | `getInferredReturnTypeFromWithClosureArgument​(Expression callArguments)` | In the case of a Object.with { ...
    `protected ClassNode` | `getOriginalDeclarationType​(Expression lhs)` |
    `protected ClassNode` | `getResultType​(ClassNode left, int op, ClassNode right, BinaryExpression expr)` |
    `protected SourceUnit` | `getSourceUnit()` |
    `protected List<ClassNode>` | `getTemporaryTypesForExpression​(Expression objectExpression)` |
    `protected ClassNode` | `getType​(ASTNode exp)` |
    `protected ClassNode[]` | `getTypeCheckingAnnotations()` | Returns array of type checking annotations.
    `TypeCheckingContext` | `getTypeCheckingContext()` | Returns the current type checking context.
    `protected static boolean` | `hasRHSIncompleteGenericTypeInfo​(ClassNode inferredRightExpressionType)` | Deprecated.
    `protected org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.SetterInfo` | `hasSetter​(PropertyExpression pexp)` | Deprecated.
    `protected void` | `inferClosureParameterTypes​(ClassNode receiver, Expression arguments, ClosureExpression expression, Parameter param, MethodNode selectedMethod)` | This method is responsible for performing type inference on closure argument types whenever code like this is found: `foo.collect { it.toUpperCase() }`.
    `protected ClassNode` | `inferComponentType​(ClassNode containerType, ClassNode indexType)` |
    `protected void` | `inferDiamondType​(ConstructorCallExpression cce, ClassNode lType)` |
    `protected ClassNode` | `inferListExpressionType​(ListExpression list)` |
    `static ClassNode` | `inferLoopElementType​(ClassNode collectionType)` | Given a loop collection type, returns the inferred type of the loop element.
    `protected ClassNode` | `inferMapExpressionType​(MapExpression map)` |
    `protected ClassNode` | `inferReturnTypeGenerics​(ClassNode receiver, MethodNode method, Expression arguments)` | If a method call returns a parameterized type, then perform additional inference on the return type, so that the type gets actual type arguments.
    `protected ClassNode` | `inferReturnTypeGenerics​(ClassNode receiver, MethodNode method, Expression arguments, GenericsType[] explicitTypeHints)` | If a method call returns a parameterized type, then perform additional inference on the return type, so that the type gets actual type arguments.
    `void` | `initialize()` |
    `protected static boolean` | `isClassInnerClassOrEqualTo​(ClassNode toBeChecked, ClassNode start)` |
    `protected boolean` | `isClosureCall​(String name, Expression objectExpression, Expression arguments)` |
    `protected static boolean` | `isNullConstant​(Expression expression)` |
    `protected boolean` | `isSecondPassNeededForControlStructure​(Map<VariableExpression,​ClassNode> varOrigType, Map<VariableExpression,​List<ClassNode>> oldTracker)` |
    `boolean` | `isSkipMode​(AnnotatedNode node)` |
    `protected boolean` | `isSkippedInnerClass​(AnnotatedNode node)` | Tests if a node is an inner class node, and if it is, then checks if the enclosing method is skipped.
    `protected List<Receiver<String>>` | `makeOwnerList​(Expression objectExpression)` | Given an object expression (a receiver expression), generate the list of potential receiver types.
    `void` | `performSecondPass()` |
    `protected Map<VariableExpression,​ClassNode>` | `popAssignmentTracking​(Map<VariableExpression,​List<ClassNode>> oldTracker)` |
    `protected static String` | `prettyPrintMethodList​(List<MethodNode> nodes)` |
    `protected Map<VariableExpression,​List<ClassNode>>` | `pushAssignmentTracking()` |
    `protected void` | `pushInstanceOfTypeInfo​(Expression objectOfInstanceOf, Expression typeExpression)` | Stores information about types when [objectOfInstanceof instanceof typeExpression] is visited.
    `protected void` | `restoreVariableExpressionMetadata​(Map<VariableExpression,​ListHashMap> typesBeforeVisit)` |
    `protected void` | `saveVariableExpressionMetadata​(Set<VariableExpression> closureSharedExpressions, Map<VariableExpression,​ListHashMap> typesBeforeVisit)` |
    `void` | `setCompilationUnit​(CompilationUnit compilationUnit)` |
    `void` | `setMethodsToBeVisited​(Set<MethodNode> methodsToBeVisited)` |
    `protected boolean` | `shouldSkipClassNode​(ClassNode node)` |
    `protected boolean` | `shouldSkipMethodNode​(MethodNode node)` |
    `protected void` | `silentlyVisitMethodNode​(MethodNode directMethodCallCandidate)` | visit a method call target, to infer the type.
    `protected void` | `startMethodInference​(MethodNode node, ErrorCollector collector)` |
    `protected ClassNode` | `storeInferredReturnType​(ASTNode node, ClassNode type)` | Stores the inferred return type of a closure or a method.
    `protected void` | `storeInferredTypeForPropertyExpression​(PropertyExpression pexp, ClassNode flatInferredType)` |
    `protected void` | `storeTargetMethod​(Expression call, MethodNode directMethodCallCandidate)` |
    `protected void` | `storeType​(Expression exp, ClassNode cn)` |
    `protected void` | `typeCheckAssignment​(BinaryExpression assignmentExpression, Expression leftExpression, ClassNode leftExpressionType, Expression rightExpression, ClassNode rightExpressionType)` |
    `protected void` | `typeCheckClosureCall​(Expression arguments, ClassNode[] argumentTypes, Parameter[] parameters)` |
    `protected MethodNode` | `typeCheckMapConstructor​(ConstructorCallExpression call, ClassNode receiver, Expression arguments)` |
    `protected boolean` | `typeCheckMethodsWithGenericsOrFail​(ClassNode receiver, ClassNode[] arguments, MethodNode candidateMethod, Expression location)` |
    `void` | `visitAttributeExpression​(AttributeExpression expression)` |
    `void` | `visitBinaryExpression​(BinaryExpression expression)` |
    `void` | `visitBitwiseNegationExpression​(BitwiseNegationExpression expression)` |
    `void` | `visitBlockStatement​(BlockStatement block)` |
    `void` | `visitCaseStatement​(CaseStatement statement)` |
    `void` | `visitCastExpression​(CastExpression expression)` |
    `void` | `visitClass​(ClassNode node)` | Visit a ClassNode.
    `void` | `visitClassExpression​(ClassExpression expression)` |
    `void` | `visitClosingBlock​(BlockStatement block)` |
    `void` | `visitClosureExpression​(ClosureExpression expression)` |
    `void` | `visitConstructor​(ConstructorNode node)` | Visit a ConstructorNode.
    `void` | `visitConstructorCallExpression​(ConstructorCallExpression call)` |
    `protected void` | `visitConstructorOrMethod​(MethodNode node, boolean isConstructor)` |
    `void` | `visitField​(FieldNode node)` | Visit a FieldNode.
    `void` | `visitForLoop​(ForStatement forLoop)` |
    `void` | `visitIfElse​(IfStatement ifElse)` |
    `void` | `visitInstanceofNot​(BinaryExpression be)` |
    `void` | `visitMethod​(MethodNode node)` | Visit a MethodNode.
    `protected void` | `visitMethodCallArguments​(ClassNode receiver, ArgumentListExpression arguments, boolean visitClosures, MethodNode selectedMethod)` |
    `void` | `visitMethodCallExpression​(MethodCallExpression call)` |
    `void` | `visitMethodPointerExpression​(MethodPointerExpression expression)` |
    `void` | `visitNotExpression​(NotExpression expression)` |
    `void` | `visitPostfixExpression​(PostfixExpression expression)` |
    `void` | `visitPrefixExpression​(PrefixExpression expression)` |
    `void` | `visitProperty​(PropertyNode node)` | Visit a PropertyNode.
    `void` | `visitPropertyExpression​(PropertyExpression pexp)` |
    `void` | `visitRangeExpression​(RangeExpression expression)` |
    `void` | `visitReturnStatement​(ReturnStatement statement)` |
    `void` | `visitStaticMethodCallExpression​(StaticMethodCallExpression call)` |
    `void` | `visitSwitch​(SwitchStatement statement)` |
    `void` | `visitTernaryExpression​(TernaryExpression expression)` |
    `void` | `visitTryCatchFinally​(TryCatchStatement statement)` |
    `void` | `visitUnaryMinusExpression​(UnaryMinusExpression expression)` |
    `void` | `visitUnaryPlusExpression​(UnaryPlusExpression expression)` |
    `void` | `visitVariableExpression​(VariableExpression vexp)` |
    `void` | `visitWhileLoop​(WhileStatement loop)` |
    `protected static ClassNode` | `wrapTypeIfNecessary​(ClassNode type)` | Returns a wrapped type if, and only if, the provided class node is a primitive type.

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

      `visitAnnotations, visitAssertStatement, visitBreakStatement, visitCatchStatement, visitClassCodeContainer, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitExpressionStatement, visitImports, visitObjectInitializerStatements, visitPackage, visitStatement, visitSynchronizedStatement, visitThrowStatement`

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

      `visitArgumentlistExpression, visitArrayExpression, visitBooleanExpression, visitBytecodeExpression, visitClosureListExpression, visitConstantExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitTupleExpression`

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

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

- - ### Field Detail

    - #### ERROR_COLLECTOR

          protected static final Object ERROR_COLLECTOR

    - #### ITERABLE_TYPE

          protected static final ClassNode ITERABLE_TYPE

    - #### EMPTY_METHODNODE_LIST

          protected static final List<MethodNode> EMPTY_METHODNODE_LIST

    - #### TYPECHECKED_CLASSNODE

          protected static final ClassNode TYPECHECKED_CLASSNODE

    - #### TYPECHECKING_ANNOTATIONS

          protected static final ClassNode[] TYPECHECKING_ANNOTATIONS

    - #### TYPECHECKING_INFO_NODE

          protected static final ClassNode TYPECHECKING_INFO_NODE

    - #### DGM_CLASSNODE

          protected static final ClassNode DGM_CLASSNODE

    - #### CURRENT_SIGNATURE_PROTOCOL_VERSION

          protected static final int CURRENT_SIGNATURE_PROTOCOL_VERSION

      See Also:
        Constant Field Values

    - #### CURRENT_SIGNATURE_PROTOCOL

          protected static final Expression CURRENT_SIGNATURE_PROTOCOL

    - #### GET_DELEGATE

          protected static final MethodNode GET_DELEGATE

    - #### GET_OWNER

          protected static final MethodNode GET_OWNER

    - #### GET_THISOBJECT

          protected static final MethodNode GET_THISOBJECT

    - #### DELEGATES_TO

          protected static final ClassNode DELEGATES_TO

    - #### DELEGATES_TO_TARGET

          protected static final ClassNode DELEGATES_TO_TARGET

    - #### LINKEDHASHMAP_CLASSNODE

          protected static final ClassNode LINKEDHASHMAP_CLASSNODE

    - #### CLOSUREPARAMS_CLASSNODE

          protected static final ClassNode CLOSUREPARAMS_CLASSNODE

    - #### NAMED_PARAMS_CLASSNODE

          protected static final ClassNode NAMED_PARAMS_CLASSNODE

    - #### MAP_ENTRY_TYPE

          protected static final ClassNode MAP_ENTRY_TYPE

    - #### ENUMERATION_TYPE

          protected static final ClassNode ENUMERATION_TYPE

    - #### GENERATED_EMPTY_STATEMENT

          public static final Statement GENERATED_EMPTY_STATEMENT

    - #### CLOSURE_CALL_NO_ARG

          public static final MethodNode CLOSURE_CALL_NO_ARG

    - #### CLOSURE_CALL_ONE_ARG

          public static final MethodNode CLOSURE_CALL_ONE_ARG

    - #### CLOSURE_CALL_VARGS

          public static final MethodNode CLOSURE_CALL_VARGS

    - #### returnListener

          protected final ReturnAdder.ReturnStatementListener returnListener

    - #### returnAdder

          protected final ReturnAdder returnAdder

    - #### currentField

          protected FieldNode currentField

    - #### currentProperty

          protected PropertyNode currentProperty

    - #### extension

          protected DefaultTypeCheckingExtension extension

    - #### typeCheckingContext

          protected TypeCheckingContext typeCheckingContext

  - ### Constructor Detail

    - #### StaticTypeCheckingVisitor

          public StaticTypeCheckingVisitor​(SourceUnit source,
                                           ClassNode classNode)

  - ### Method Detail

    - #### getSourceUnit

          protected SourceUnit getSourceUnit()

      Specified by:
        `getSourceUnit` in class `ClassCodeVisitorSupport`

    - #### initialize

          public void initialize()

    - #### getTypeCheckingContext

          public TypeCheckingContext getTypeCheckingContext()

      Returns the current type checking context. The context is used internally by the type checker during type checking to store various state data.
      Returns:
        the type checking context

    - #### addTypeCheckingExtension

          public void addTypeCheckingExtension​(TypeCheckingExtension extension)

    - #### setCompilationUnit

          public void setCompilationUnit​(CompilationUnit compilationUnit)

    - #### visitClass

          public void visitClass​(ClassNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a ClassNode.
      Specified by:
        `visitClass` in interface `GroovyClassVisitor`
      Overrides:
        `visitClass` in class `ClassCodeVisitorSupport`

    - #### getTypeCheckingAnnotations

          protected ClassNode[] getTypeCheckingAnnotations()

      Returns array of type checking annotations. Subclasses may override this method in order to provide additional types which must be looked up when checking if a method or a class node should be skipped.

      The default implementation returns `TypeChecked`.

    - #### shouldSkipClassNode

          protected boolean shouldSkipClassNode​(ClassNode node)

    - #### isSkipMode

          public boolean isSkipMode​(AnnotatedNode node)

    - #### isSkippedInnerClass

          protected boolean isSkippedInnerClass​(AnnotatedNode node)

      Tests if a node is an inner class node, and if it is, then checks if the enclosing method is skipped.
      Returns:
        true if the inner class node should be skipped

    - #### visitClassExpression

          public void visitClassExpression​(ClassExpression expression)

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

    - #### visitVariableExpression

          public void visitVariableExpression​(VariableExpression vexp)

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

    - #### visitPropertyExpression

          public void visitPropertyExpression​(PropertyExpression pexp)

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

    - #### visitAttributeExpression

          public void visitAttributeExpression​(AttributeExpression expression)

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

    - #### visitRangeExpression

          public void visitRangeExpression​(RangeExpression expression)

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

    - #### visitNotExpression

          public void visitNotExpression​(NotExpression expression)

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

    - #### visitBinaryExpression

          public void visitBinaryExpression​(BinaryExpression expression)

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

    - #### getOriginalDeclarationType

          protected ClassNode getOriginalDeclarationType​(Expression lhs)

    - #### inferDiamondType

          protected void inferDiamondType​(ConstructorCallExpression cce,
                                          ClassNode lType)

    - #### pushInstanceOfTypeInfo

          protected void pushInstanceOfTypeInfo​(Expression objectOfInstanceOf,
                                                Expression typeExpression)

      Stores information about types when [objectOfInstanceof instanceof typeExpression] is visited.
      Parameters:
        `objectOfInstanceOf` - the expression which must be checked against instanceof
        `typeExpression` - the expression which represents the target type

    - #### typeCheckAssignment

          protected void typeCheckAssignment​(BinaryExpression assignmentExpression,
                                             Expression leftExpression,
                                             ClassNode leftExpressionType,
                                             Expression rightExpression,
                                             ClassNode rightExpressionType)

    - #### checkGroovyConstructorMap

          protected void checkGroovyConstructorMap​(Expression receiver,
                                                   ClassNode receiverType,
                                                   MapExpression mapExpression)

    - #### hasRHSIncompleteGenericTypeInfo

          @Deprecated
          protected static boolean hasRHSIncompleteGenericTypeInfo​(ClassNode inferredRightExpressionType)

      Deprecated.

    - #### checkGroovyStyleConstructor

          @Deprecated
          protected void checkGroovyStyleConstructor​(ClassNode node,
                                                     ClassNode[] arguments)

      Deprecated.
      use `checkGroovyStyleConstructor(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.ClassNode[], org.codehaus.groovy.ast.ASTNode)` )}
      Checks that a constructor style expression is valid regarding the number of arguments and the argument types.
      Parameters:
        `node` - the class node for which we will try to find a matching constructor
        `arguments` - the constructor arguments

    - #### checkGroovyStyleConstructor

          protected MethodNode checkGroovyStyleConstructor​(ClassNode node,
                                                           ClassNode[] arguments,
                                                           ASTNode source)

      Checks that a constructor style expression is valid regarding the number of arguments and the argument types.
      Parameters:
        `node` - the class node for which we will try to find a matching constructor
        `arguments` - the constructor arguments

    - #### extractTemporaryTypeInfoKey

          protected Object extractTemporaryTypeInfoKey​(Expression expression)

      When instanceof checks are found in the code, we store temporary type information data in the `TypeCheckingContext.temporaryIfBranchTypeInformation` table. This method computes the key which must be used to store this type info.
      Parameters:
        `expression` - the expression for which to compute the key
      Returns:
        a key to be used for `TypeCheckingContext.temporaryIfBranchTypeInformation`

    - #### findCurrentInstanceOfClass

          protected ClassNode findCurrentInstanceOfClass​(Expression expr,
                                                         ClassNode type)

      A helper method which determines which receiver class should be used in error messages when a field or attribute is not found. The returned type class depends on whether we have temporary type information available (due to instanceof checks) and whether there is a single candidate in that case.
      Parameters:
        `expr` - the expression for which an unknown field has been found
        `type` - the type of the expression (used as fallback type)
      Returns:
        if temporary information is available and there's only one type, returns the temporary type class otherwise falls back to the provided type class.

    - #### existsProperty

          protected boolean existsProperty​(PropertyExpression pexp,
                                           boolean checkForReadOnly)

    - #### existsProperty

          protected boolean existsProperty​(PropertyExpression pexp,
                                           boolean readMode,
                                           ClassCodeVisitorSupport visitor)

      Checks whether a property exists on the receiver, or on any of the possible receiver classes (found in the temporary type information table)
      Parameters:
        `pexp` - a property expression
        `readMode` - if true, look for property read, else for property set
        `visitor` - if not null, when the property node is found, visit it with the provided visitor
      Returns:
        true if the property is defined in any of the possible receiver classes

    - #### storeInferredTypeForPropertyExpression

          protected void storeInferredTypeForPropertyExpression​(PropertyExpression pexp,
                                                                ClassNode flatInferredType)

    - #### hasSetter

          @Deprecated
          protected org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.SetterInfo hasSetter​(PropertyExpression pexp)

      Deprecated.

    - #### visitProperty

          public void visitProperty​(PropertyNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a PropertyNode.
      Specified by:
        `visitProperty` in interface `GroovyClassVisitor`
      Overrides:
        `visitProperty` in class `ClassCodeVisitorSupport`

    - #### visitField

          public void visitField​(FieldNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a FieldNode.
      Specified by:
        `visitField` in interface `GroovyClassVisitor`
      Overrides:
        `visitField` in class `ClassCodeVisitorSupport`

    - #### visitForLoop

          public void visitForLoop​(ForStatement forLoop)

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

    - #### inferLoopElementType

          public static ClassNode inferLoopElementType​(ClassNode collectionType)

      Given a loop collection type, returns the inferred type of the loop element. Used, for example, to infer the element type of a (for e in list) loop.
      Parameters:
        `collectionType` - the type of the collection
      Returns:
        the inferred component type

    - #### isSecondPassNeededForControlStructure

          protected boolean isSecondPassNeededForControlStructure​(Map<VariableExpression,​ClassNode> varOrigType,
                                                                  Map<VariableExpression,​List<ClassNode>> oldTracker)

    - #### visitWhileLoop

          public void visitWhileLoop​(WhileStatement loop)

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

    - #### visitBitwiseNegationExpression

          public void visitBitwiseNegationExpression​(BitwiseNegationExpression expression)

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

    - #### visitUnaryPlusExpression

          public void visitUnaryPlusExpression​(UnaryPlusExpression expression)

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

    - #### visitUnaryMinusExpression

          public void visitUnaryMinusExpression​(UnaryMinusExpression expression)

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

    - #### visitPostfixExpression

          public void visitPostfixExpression​(PostfixExpression expression)

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

    - #### visitPrefixExpression

          public void visitPrefixExpression​(PrefixExpression expression)

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

    - #### visitConstructorOrMethod

          protected void visitConstructorOrMethod​(MethodNode node,
                                                  boolean isConstructor)

      Overrides:
        `visitConstructorOrMethod` in class `ClassCodeVisitorSupport`

    - #### visitReturnStatement

          public void visitReturnStatement​(ReturnStatement statement)

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

    - #### checkReturnType

          protected ClassNode checkReturnType​(ReturnStatement statement)

    - #### addClosureReturnType

          protected void addClosureReturnType​(ClassNode returnType)

    - #### visitConstructorCallExpression

          public void visitConstructorCallExpression​(ConstructorCallExpression call)

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

    - #### typeCheckMapConstructor

          protected MethodNode typeCheckMapConstructor​(ConstructorCallExpression call,
                                                       ClassNode receiver,
                                                       Expression arguments)

    - #### getArgumentTypes

          protected ClassNode[] getArgumentTypes​(ArgumentListExpression args)

    - #### visitClosureExpression

          public void visitClosureExpression​(ClosureExpression expression)

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

    - #### visitMethodPointerExpression

          public void visitMethodPointerExpression​(MethodPointerExpression expression)

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

    - #### getDelegationMetadata

          protected org.codehaus.groovy.transform.stc.DelegationMetadata getDelegationMetadata​(ClosureExpression expression)

    - #### restoreVariableExpressionMetadata

          protected void restoreVariableExpressionMetadata​(Map<VariableExpression,​ListHashMap> typesBeforeVisit)

    - #### saveVariableExpressionMetadata

          protected void saveVariableExpressionMetadata​(Set<VariableExpression> closureSharedExpressions,
                                                        Map<VariableExpression,​ListHashMap> typesBeforeVisit)

    - #### shouldSkipMethodNode

          protected boolean shouldSkipMethodNode​(MethodNode node)

    - #### visitMethod

          public void visitMethod​(MethodNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a MethodNode.
      Specified by:
        `visitMethod` in interface `GroovyClassVisitor`
      Overrides:
        `visitMethod` in class `ClassCodeVisitorSupport`

    - #### visitConstructor

          public void visitConstructor​(ConstructorNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a ConstructorNode.
      Specified by:
        `visitConstructor` in interface `GroovyClassVisitor`
      Overrides:
        `visitConstructor` in class `ClassCodeVisitorSupport`

    - #### startMethodInference

          protected void startMethodInference​(MethodNode node,
                                              ErrorCollector collector)

    - #### addTypeCheckingInfoAnnotation

          protected void addTypeCheckingInfoAnnotation​(MethodNode node)

    - #### visitStaticMethodCallExpression

          public void visitStaticMethodCallExpression​(StaticMethodCallExpression call)

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

    - #### checkClosureParameters

          @Deprecated
          protected void checkClosureParameters​(Expression callArguments,
                                                ClassNode receiver)

      Deprecated.
      this method is unused, replaced with `DelegatesTo` inference.

    - #### silentlyVisitMethodNode

          protected void silentlyVisitMethodNode​(MethodNode directMethodCallCandidate)

      visit a method call target, to infer the type. Don't report errors right away, that will be done by a later visitMethod call

    - #### visitMethodCallArguments

          protected void visitMethodCallArguments​(ClassNode receiver,
                                                  ArgumentListExpression arguments,
                                                  boolean visitClosures,
                                                  MethodNode selectedMethod)

    - #### inferClosureParameterTypes

          protected void inferClosureParameterTypes​(ClassNode receiver,
                                                    Expression arguments,
                                                    ClosureExpression expression,
                                                    Parameter param,
                                                    MethodNode selectedMethod)

      This method is responsible for performing type inference on closure argument types whenever code like this is found: `foo.collect { it.toUpperCase() }`. In this case, the type checker tries to find if the `collect` method has its `Closure` argument annotated with `ClosureParams`. If yes, then additional type inference can be performed and the type of `it` may be inferred.
      Parameters:
        `receiver` -
        `arguments` -
        `expression` - a closure expression for which the argument types should be inferred
        `param` - the parameter where to look for a `ClosureParams` annotation.
        `selectedMethod` - the method accepting a closure

    - #### addReceivers

          protected void addReceivers​(List<Receiver<String>> receivers,
                                      Collection<Receiver<String>> owners,
                                      boolean implicitThis)

    - #### visitMethodCallExpression

          public void visitMethodCallExpression​(MethodCallExpression call)

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

    - #### getInferredReturnTypeFromWithClosureArgument

          protected ClassNode getInferredReturnTypeFromWithClosureArgument​(Expression callArguments)

      In the case of a Object.with { ... } call, this method is supposed to retrieve the inferred closure return type.
      Parameters:
        `callArguments` - the argument list from the Object#with(Closure) call, ie. a single closure expression
      Returns:
        the inferred closure return type or null

    - #### makeOwnerList

          protected List<Receiver<String>> makeOwnerList​(Expression objectExpression)

      Given an object expression (a receiver expression), generate the list of potential receiver types.
      Parameters:
        `objectExpression` - the receiver expression
      Returns:
        the list of types the receiver may be

    - #### checkForbiddenSpreadArgument

          protected void checkForbiddenSpreadArgument​(ArgumentListExpression argumentList)

    - #### getTemporaryTypesForExpression

          protected List<ClassNode> getTemporaryTypesForExpression​(Expression objectExpression)

    - #### storeTargetMethod

          protected void storeTargetMethod​(Expression call,
                                           MethodNode directMethodCallCandidate)

    - #### isClosureCall

          protected boolean isClosureCall​(String name,
                                          Expression objectExpression,
                                          Expression arguments)

    - #### typeCheckClosureCall

          protected void typeCheckClosureCall​(Expression arguments,
                                              ClassNode[] argumentTypes,
                                              Parameter[] parameters)

    - #### visitIfElse

          public void visitIfElse​(IfStatement ifElse)

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

    - #### visitInstanceofNot

          public void visitInstanceofNot​(BinaryExpression be)

    - #### visitBlockStatement

          public void visitBlockStatement​(BlockStatement block)

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

    - #### visitClosingBlock

          public void visitClosingBlock​(BlockStatement block)

    - #### findInstanceOfNotReturnExpression

          public BinaryExpression findInstanceOfNotReturnExpression​(IfStatement ifElse)

      Check IfStatement matched pattern : Object var1; if (!(var1 instanceOf Runnable)){ return } // Here var1 instance of Runnable

      Return expression , which contains instanceOf (without not) Return null, if not found

    - #### visitSwitch

          public void visitSwitch​(SwitchStatement statement)

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

    - #### visitCaseStatement

          public void visitCaseStatement​(CaseStatement statement)

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

    - #### popAssignmentTracking

          protected Map<VariableExpression,​ClassNode> popAssignmentTracking​(Map<VariableExpression,​List<ClassNode>> oldTracker)

    - #### pushAssignmentTracking

          protected Map<VariableExpression,​List<ClassNode>> pushAssignmentTracking()

    - #### visitCastExpression

          public void visitCastExpression​(CastExpression expression)

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

    - #### checkCast

          protected boolean checkCast​(ClassNode targetType,
                                      Expression source)

    - #### visitTernaryExpression

          public void visitTernaryExpression​(TernaryExpression expression)

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

    - #### visitTryCatchFinally

          public void visitTryCatchFinally​(TryCatchStatement statement)

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

    - #### storeType

          protected void storeType​(Expression exp,
                                   ClassNode cn)

    - #### getResultType

          protected ClassNode getResultType​(ClassNode left,
                                            int op,
                                            ClassNode right,
                                            BinaryExpression expr)

    - #### getGroupOperationResultType

          protected static ClassNode getGroupOperationResultType​(ClassNode a,
                                                                 ClassNode b)

    - #### inferComponentType

          protected ClassNode inferComponentType​(ClassNode containerType,
                                                 ClassNode indexType)

    - #### findMethodOrFail

          protected MethodNode findMethodOrFail​(Expression expr,
                                                ClassNode receiver,
                                                String name,
                                                ClassNode... args)

    - #### prettyPrintMethodList

          protected static String prettyPrintMethodList​(List<MethodNode> nodes)

    - #### areCategoryMethodCalls

          protected boolean areCategoryMethodCalls​(List<MethodNode> foundMethods,
                                                   String name,
                                                   ClassNode[] args)

    - #### findMethodsWithGenerated

          protected List<MethodNode> findMethodsWithGenerated​(ClassNode receiver,
                                                              String name)

      This method returns the list of methods named against the supplied parameter that are defined on the specified receiver, but it will also add "non existing" methods that will be generated afterwards by the compiler, for example if a method is using default values and that the specified class node isn't compiled yet.
      Parameters:
        `receiver` - the receiver where to find methods
        `name` - the name of the methods to return
      Returns:
        the methods that are defined on the receiver completed with stubs for future methods

    - #### findMethod

          protected List<MethodNode> findMethod​(ClassNode receiver,
                                                String name,
                                                ClassNode... args)

    - #### extractPropertyNameFromMethodName

          public static String extractPropertyNameFromMethodName​(String prefix,
                                                                 String methodName)

      Given a method name and a prefix, returns the name of the property that should be looked up, following the java beans rules. For example, "getName" would return "name", while "getFullName" would return "fullName". If the prefix is not found, returns null.
      Parameters:
        `prefix` - the method name prefix ("get", "is", "set", ...)
        `methodName` - the method name
      Returns:
        a property name if the prefix is found and the method matches the java beans rules, null otherwise

    - #### collectAllInterfaceMethodsByName

          protected void collectAllInterfaceMethodsByName​(ClassNode type,
                                                          String name,
                                                          List<MethodNode> methods)

    - #### getType

          protected ClassNode getType​(ASTNode exp)

    - #### storeInferredReturnType

          protected ClassNode storeInferredReturnType​(ASTNode node,
                                                      ClassNode type)

      Stores the inferred return type of a closure or a method. We are using a separate key to store inferred return type because the inferred type of a closure is `Closure`, which is different from the inferred type of the code of the closure.
      Parameters:
        `node` - a `ClosureExpression` or a `MethodNode`
        `type` - the inferred return type of the code
      Returns:
        the old value of the inferred type

    - #### getInferredReturnType

          protected ClassNode getInferredReturnType​(ASTNode exp)

      Returns the inferred return type of a closure or a method, if stored on the AST node. This method doesn't perform any type inference by itself.
      Parameters:
        `exp` - a `ClosureExpression` or `MethodNode`
      Returns:
        the inferred type, as stored on node metadata.

    - #### inferListExpressionType

          protected ClassNode inferListExpressionType​(ListExpression list)

    - #### isNullConstant

          protected static boolean isNullConstant​(Expression expression)

    - #### inferMapExpressionType

          protected ClassNode inferMapExpressionType​(MapExpression map)

    - #### inferReturnTypeGenerics

          protected ClassNode inferReturnTypeGenerics​(ClassNode receiver,
                                                      MethodNode method,
                                                      Expression arguments)

      If a method call returns a parameterized type, then perform additional inference on the return type, so that the type gets actual type arguments. For example, the method `Arrays.asList(T...)` is parameterized with `T`, which can be deduced type arguments or call arguments.
      Parameters:
        `method` - the method node
        `arguments` - the method call arguments
        `receiver` - the object expression type

    - #### inferReturnTypeGenerics

          protected ClassNode inferReturnTypeGenerics​(ClassNode receiver,
                                                      MethodNode method,
                                                      Expression arguments,
                                                      GenericsType[] explicitTypeHints)

      If a method call returns a parameterized type, then perform additional inference on the return type, so that the type gets actual type arguments. For example, the method `Arrays.asList(T...)` is parameterized with `T`, which can be deduced type arguments or call arguments.
      Parameters:
        `method` - the method node
        `arguments` - the method call arguments
        `receiver` - the object expression type
        `explicitTypeHints` - type arguments (optional), for example `Collections.<String>emptyList()`

    - #### typeCheckMethodsWithGenericsOrFail

          protected boolean typeCheckMethodsWithGenericsOrFail​(ClassNode receiver,
                                                               ClassNode[] arguments,
                                                               MethodNode candidateMethod,
                                                               Expression location)

    - #### formatArgumentList

          protected static String formatArgumentList​(ClassNode[] nodes)

    - #### addError

          public void addError​(String msg,
                               ASTNode expr)

      Specified by:
        `addError` in interface `ErrorCollecting`
      Overrides:
        `addError` in class `ClassCodeVisitorSupport`

    - #### addStaticTypeError

          protected void addStaticTypeError​(String msg,
                                            ASTNode expr)

    - #### addNoMatchingMethodError

          protected void addNoMatchingMethodError​(ClassNode receiver,
                                                  String name,
                                                  ClassNode[] args,
                                                  Expression call)

    - #### addAmbiguousErrorMessage

          protected void addAmbiguousErrorMessage​(List<MethodNode> foundMethods,
                                                  String name,
                                                  ClassNode[] args,
                                                  Expression expr)

    - #### addCategoryMethodCallError

          protected void addCategoryMethodCallError​(Expression call)

    - #### addAssignmentError

          protected void addAssignmentError​(ClassNode leftType,
                                            ClassNode rightType,
                                            Expression assignmentExpression)

    - #### addUnsupportedPreOrPostfixExpressionError

          protected void addUnsupportedPreOrPostfixExpressionError​(Expression expression)

    - #### setMethodsToBeVisited

          public void setMethodsToBeVisited​(Set<MethodNode> methodsToBeVisited)

    - #### performSecondPass

          public void performSecondPass()

    - #### extractTypesFromParameters

          protected static ClassNode[] extractTypesFromParameters​(Parameter[] parameters)

    - #### wrapTypeIfNecessary

          protected static ClassNode wrapTypeIfNecessary​(ClassNode type)

      Returns a wrapped type if, and only if, the provided class node is a primitive type. This method differs from `ClassHelper.getWrapper(org.codehaus.groovy.ast.ClassNode)` as it will return the same instance if the provided type is not a generic type.
      Returns:
        the wrapped type

    - #### isClassInnerClassOrEqualTo

          protected static boolean isClassInnerClassOrEqualTo​(ClassNode toBeChecked,
                                                              ClassNode start)