[Java] Class StaticTypeCheckingVisitor 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor 
  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
  Modifiers Name Description   
static class  StaticTypeCheckingVisitor.SignatureCodecFactory    
protected class  StaticTypeCheckingVisitor.VariableExpressionTypeMemoizer    Field Summary  
Fields
  Modifiers Name Description   
protected static ClassNode  CLOSUREPARAMS_CLASSNODE    
static MethodNode  CLOSURE_CALL_NO_ARG    
static MethodNode  CLOSURE_CALL_ONE_ARG    
static MethodNode  CLOSURE_CALL_VARGS    
protected static Expression  CURRENT_SIGNATURE_PROTOCOL    
protected static int  CURRENT_SIGNATURE_PROTOCOL_VERSION    
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    
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 static ClassNode  TYPECHECKED_CLASSNODE    
protected static ClassNode[]  TYPECHECKING_ANNOTATIONS    
protected static ClassNode  TYPECHECKING_INFO_NODE    
protected FieldNode  currentField    
protected PropertyNode  currentProperty    
protected DefaultTypeCheckingExtension  extension    
protected ReturnAdder  returnAdder    
protected ReturnStatementListener  returnListener    
protected TypeCheckingContext  typeCheckingContext    Constructor Summary  
Constructors
  Constructor and description    StaticTypeCheckingVisitor(SourceUnit source, ClassNode classNode)
   Methods Summary  
Methods
  Type Params Return Type Name and description    protected void 
addAmbiguousErrorMessage(List<MethodNode> foundMethods, String name, ClassNode[] args, Expression expr)
    protected void 
addAssignmentError(ClassNode leftType, ClassNode rightType, Expression expression)
    protected void 
addCategoryMethodCallError(Expression call)
    protected void 
addClosureReturnType(ClassNode returnType)
    public 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)
    public void 
addTypeCheckingExtension(TypeCheckingExtension extension)
    protected void 
addTypeCheckingInfoAnnotation(MethodNode node)
    protected void 
addUnsupportedPreOrPostfixExpressionError(Expression expression)
    protected void 
afterSwitchConditionExpressionVisited(SwitchStatement statement)
    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)Checks that a constructor style expression is valid regarding the number of arguments and the argument types.    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 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)    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.     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.     protected BinaryExpression 
findInstanceOfNotReturnExpression(IfStatement ifElse)Check IfStatement matched pattern : Object var1; if (!    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)Returns methods defined for the specified receiver and adds "non-existing" methods that will be generated afterwards by the compiler; for example if a method is using default values and the class node isn't compiled yet.    protected BinaryExpression 
findNotInstanceOfReturnExpression(IfStatement ifElse)Check IfStatement matched pattern : Object var1; if (var1 !    protected static String 
formatArgumentList(ClassNode[] nodes)
    protected ClassNode[] 
getArgumentTypes(ArgumentListExpression args)
    protected 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 { ... } call, this method is supposed to retrieve the inferred closure return type.    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.     public TypeCheckingContext 
getTypeCheckingContext()Returns the current type checking context.     protected static boolean 
hasRHSIncompleteGenericTypeInfo(ClassNode inferredRightExpressionType)
    protected void 
inferClosureParameterTypes(ClassNode receiver, Expression arguments, ClosureExpression expression, Parameter target, MethodNode method)Performs 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)
    public 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.     public void 
initialize()
    protected static boolean 
isClassInnerClassOrEqualTo(ClassNode toBeChecked, ClassNode start)
    protected static boolean 
isNullConstant(Expression expression)
    protected boolean 
isSecondPassNeededForControlStructure(Map<VariableExpression, ClassNode> varOrigType, Map<VariableExpression, List<ClassNode>> oldTracker)
    public 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 static boolean 
isSuperExpression(Expression expression)
    protected static boolean 
isThisExpression(Expression expression)
    protected List<Receiver<String>> 
makeOwnerList(Expression objectExpression)Given an object expression (a receiver expression), generate the list of potential receiver types.    public 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, Map<StaticTypesMarker, Object>> typesBeforeVisit)
    public void 
returnStatementAdded(ReturnStatement returnStatement)
    protected void 
saveVariableExpressionMetadata(Set<VariableExpression> closureSharedExpressions, Map<VariableExpression, Map<StaticTypesMarker, Object>> typesBeforeVisit)
    public void 
setCompilationUnit(CompilationUnit compilationUnit)
    public void 
setMethodsToBeVisited(Set<MethodNode> methodsToBeVisited)
    protected boolean 
shouldSkipClassNode(ClassNode node)
    protected boolean 
shouldSkipMethodNode(MethodNode node)
    protected void 
silentlyVisitMethodNode(MethodNode directMethodCallCandidate)Visits 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 
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)
    public void 
visitArrayExpression(ArrayExpression expression)
    public void 
visitAttributeExpression(AttributeExpression expression)
    public void 
visitBinaryExpression(BinaryExpression expression)
    public void 
visitBitwiseNegationExpression(BitwiseNegationExpression expression)
    public void 
visitBlockStatement(BlockStatement block)
    public void 
visitCaseStatement(CaseStatement statement)
    public void 
visitCastExpression(CastExpression expression)
    public void 
visitClass(ClassNode node)
    public void 
visitClassExpression(ClassExpression expression)
    public void 
visitClosingBlock(BlockStatement block)
    public void 
visitClosureExpression(ClosureExpression expression)
    public void 
visitClosureExpression(ClosureExpression expression)
    public void 
visitConstructor(ConstructorNode node)
    public void 
visitConstructorCallExpression(ConstructorCallExpression call)
    protected void 
visitConstructorOrMethod(MethodNode node, boolean isConstructor)
    public void 
visitExpressionStatement(ExpressionStatement statement)
    public void 
visitField(FieldNode node)
    public void 
visitForLoop(ForStatement forLoop)
    public void 
visitIfElse(IfStatement ifElse)
    protected void 
visitInstanceofNot(BinaryExpression be)
    public void 
visitMethod(MethodNode node)
    protected void 
visitMethodCallArguments(ClassNode receiver, ArgumentListExpression arguments, boolean visitClosures, MethodNode selectedMethod)
    public void 
visitMethodCallExpression(MethodCallExpression mce)
    public void 
visitMethodCallExpression(MethodCallExpression call)
    public void 
visitMethodPointerExpression(MethodPointerExpression expression)
    public void 
visitNotExpression(NotExpression expression)
    protected void 
visitObjectInitializerStatements(ClassNode node)
    public void 
visitPostfixExpression(PostfixExpression expression)
    public void 
visitPrefixExpression(PrefixExpression expression)
    public void 
visitProperty(PropertyNode node)
    public void 
visitPropertyExpression(PropertyExpression expression)
    public void 
visitRangeExpression(RangeExpression expression)
    public void 
visitReturnStatement(ReturnStatement statement)
    public void 
visitReturnStatement(ReturnStatement returnStatement)
    public void 
visitStaticMethodCallExpression(StaticMethodCallExpression call)
    public void 
visitSwitch(SwitchStatement statement)
    public void 
visitTernaryExpression(TernaryExpression expression)
    public void 
visitTryCatchFinally(TryCatchStatement statement)
    public void 
visitUnaryMinusExpression(UnaryMinusExpression expression)
    public void 
visitUnaryPlusExpression(UnaryPlusExpression expression)
    public void 
visitVariableExpression(VariableExpression vexp)
    public 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.    Inherited Methods Summary  
Inherited Methods
  Methods inherited from class Name   class ClassCodeVisitorSupport addError, getSourceUnit, visitAnnotation, visitAnnotations, visitAnnotations, visitAssertStatement, visitBlockStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoop   class CodeVisitorSupport afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop     Field Detail protected static final ClassNode CLOSUREPARAMS_CLASSNODE
 public static final MethodNode CLOSURE_CALL_NO_ARG
 public static final MethodNode CLOSURE_CALL_ONE_ARG
 public static final MethodNode CLOSURE_CALL_VARGS
 protected static final Expression CURRENT_SIGNATURE_PROTOCOL
 protected static final int CURRENT_SIGNATURE_PROTOCOL_VERSION
 protected static final ClassNode DELEGATES_TO
 protected static final ClassNode DELEGATES_TO_TARGET
 protected static final ClassNode DGM_CLASSNODE
 protected static final List<MethodNode> EMPTY_METHODNODE_LIST
 protected static final ClassNode ENUMERATION_TYPE
 protected static final Object ERROR_COLLECTOR
 public static final Statement GENERATED_EMPTY_STATEMENT
 protected static final MethodNode GET_DELEGATE
 protected static final MethodNode GET_OWNER
 protected static final MethodNode GET_THISOBJECT
 protected static final ClassNode ITERABLE_TYPE
 @Deprecated protected static final ClassNode LINKEDHASHMAP_CLASSNODE
 protected static final ClassNode MAP_ENTRY_TYPE
 protected static final ClassNode NAMED_PARAMS_CLASSNODE
 protected static final ClassNode TYPECHECKED_CLASSNODE
 protected static final ClassNode[] TYPECHECKING_ANNOTATIONS
 protected static final ClassNode TYPECHECKING_INFO_NODE
 protected FieldNode currentField
 protected PropertyNode currentProperty
 protected DefaultTypeCheckingExtension extension
 protected final ReturnAdder returnAdder
 protected final ReturnStatementListener returnListener
 protected TypeCheckingContext typeCheckingContext
 Constructor Detail public StaticTypeCheckingVisitor(SourceUnit source, ClassNode classNode) Method Detail protected void addAmbiguousErrorMessage(List<MethodNode> foundMethods, String name, ClassNode[] args, Expression expr) protected void addAssignmentError(ClassNode leftType, ClassNode rightType, Expression expression) protected void addCategoryMethodCallError(Expression call) protected void addClosureReturnType(ClassNode returnType) @Override public 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) public void addTypeCheckingExtension(TypeCheckingExtension extension) protected void addTypeCheckingInfoAnnotation(MethodNode node) protected void addUnsupportedPreOrPostfixExpressionError(Expression expression) @Override protected void afterSwitchConditionExpressionVisited(SwitchStatement statement) protected boolean areCategoryMethodCalls(List<MethodNode> foundMethods, String name, ClassNode[] args) protected boolean checkCast(ClassNode targetType, Expression source) @Deprecated 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) @Deprecated protected void checkGroovyStyleConstructor(ClassNode node, ClassNode[] arguments)  Checks that a constructor style expression is valid regarding the number of arguments and the argument types.

deprecated:
use checkGroovyStyleConstructor(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.ClassNode[], org.codehaus.groovy.ast.ASTNode) )}
 
Parameters:

node - the class node for which we will try to find a matching constructor

arguments - the constructor arguments
 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
 protected ClassNode checkReturnType(ReturnStatement statement) 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) 

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
 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
 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

 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. 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.
 protected 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  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)  Returns methods defined for the specified receiver and adds "non-existing" methods that will be generated afterwards by the compiler; for example if a method is using default values and the 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
 protected BinaryExpression findNotInstanceOfReturnExpression(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  protected static String formatArgumentList(ClassNode[] nodes) protected ClassNode[] getArgumentTypes(ArgumentListExpression args) protected 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. 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.
 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

 protected ClassNode getOriginalDeclarationType(Expression lhs) protected ClassNode getResultType(ClassNode left, int op, ClassNode right, BinaryExpression expr) @Override protected SourceUnit getSourceUnit() protected List<ClassNode> getTemporaryTypesForExpression(Expression objectExpression) protected ClassNode getType(ASTNode exp) 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.  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
 @Deprecated protected static boolean hasRHSIncompleteGenericTypeInfo(ClassNode inferredRightExpressionType) protected void inferClosureParameterTypes(ClassNode receiver, Expression arguments, ClosureExpression expression, Parameter target, MethodNode method)  Performs 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 so, then additional type inference can be performed and the type of it may be inferred. 

Parameters:
receiver
arguments

expression - closure or lambda expression for which the argument types should be inferred

target - parameter which may provide ClosureParams annotation or SAM type

method - method that declares target

 protected ClassNode inferComponentType(ClassNode containerType, ClassNode indexType) protected void inferDiamondType(ConstructorCallExpression cce, ClassNode lType) protected ClassNode inferListExpressionType(ListExpression list) 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
 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. 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
 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()

 public void initialize() protected static boolean isClassInnerClassOrEqualTo(ClassNode toBeChecked, ClassNode start) protected static boolean isNullConstant(Expression expression) protected boolean isSecondPassNeededForControlStructure(Map<VariableExpression, ClassNode> varOrigType, Map<VariableExpression, List<ClassNode>> oldTracker) public 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. 

Returns:
true if the inner class node should be skipped
 protected static boolean isSuperExpression(Expression expression) protected static boolean isThisExpression(Expression expression) 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
 public 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. 

Parameters:

objectOfInstanceOf - the expression which must be checked against instanceof

typeExpression - the expression which represents the target type
 protected void restoreVariableExpressionMetadata(Map<VariableExpression, Map<StaticTypesMarker, Object>> typesBeforeVisit) @Override public void returnStatementAdded(ReturnStatement returnStatement) protected void saveVariableExpressionMetadata(Set<VariableExpression> closureSharedExpressions, Map<VariableExpression, Map<StaticTypesMarker, Object>> typesBeforeVisit) public void setCompilationUnit(CompilationUnit compilationUnit) public void setMethodsToBeVisited(Set<MethodNode> methodsToBeVisited) protected boolean shouldSkipClassNode(ClassNode node) protected boolean shouldSkipMethodNode(MethodNode node) protected void silentlyVisitMethodNode(MethodNode directMethodCallCandidate)  Visits a method call target, to infer the type. Don't report errors right away, that will be done by a later visitMethod call.  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. 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
 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) @Override public void visitArrayExpression(ArrayExpression expression) @Override public void visitAttributeExpression(AttributeExpression expression) @Override public void visitBinaryExpression(BinaryExpression expression) @Override public void visitBitwiseNegationExpression(BitwiseNegationExpression expression) @Override public void visitBlockStatement(BlockStatement block) @Override public void visitCaseStatement(CaseStatement statement) @Override public void visitCastExpression(CastExpression expression) @Override public void visitClass(ClassNode node) @Override public void visitClassExpression(ClassExpression expression) public void visitClosingBlock(BlockStatement block) @Override public void visitClosureExpression(ClosureExpression expression) @Override public void visitClosureExpression(ClosureExpression expression) @Override public void visitConstructor(ConstructorNode node) @Override public void visitConstructorCallExpression(ConstructorCallExpression call) @Override protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) @Override public void visitExpressionStatement(ExpressionStatement statement) @Override public void visitField(FieldNode node) @Override public void visitForLoop(ForStatement forLoop) @Override public void visitIfElse(IfStatement ifElse) protected void visitInstanceofNot(BinaryExpression be) @Override public void visitMethod(MethodNode node) protected void visitMethodCallArguments(ClassNode receiver, ArgumentListExpression arguments, boolean visitClosures, MethodNode selectedMethod) @Override public void visitMethodCallExpression(MethodCallExpression mce) @Override public void visitMethodCallExpression(MethodCallExpression call) @Override public void visitMethodPointerExpression(MethodPointerExpression expression) @Override public void visitNotExpression(NotExpression expression) @Override protected void visitObjectInitializerStatements(ClassNode node) @Override public void visitPostfixExpression(PostfixExpression expression) @Override public void visitPrefixExpression(PrefixExpression expression) @Override public void visitProperty(PropertyNode node) @Override public void visitPropertyExpression(PropertyExpression expression) @Override public void visitRangeExpression(RangeExpression expression) @Override public void visitReturnStatement(ReturnStatement statement) @Override public void visitReturnStatement(ReturnStatement returnStatement) @Override public void visitStaticMethodCallExpression(StaticMethodCallExpression call) @Override public void visitSwitch(SwitchStatement statement) @Override public void visitTernaryExpression(TernaryExpression expression) @Override public void visitTryCatchFinally(TryCatchStatement statement) @Override public void visitUnaryMinusExpression(UnaryMinusExpression expression) @Override public void visitUnaryPlusExpression(UnaryPlusExpression expression) @Override public void visitVariableExpression(VariableExpression vexp) @Override public 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. 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
 

    
{'path': 'public/docs/groovy~4.0/org/codehaus/groovy/transform/stc/statictypecheckingvisitor.html', 'source': 'DevDocs.IO'}