Groovy 2.2.0

org.codehaus.groovy.transform.stc
[Java] Class StaticTypeCheckingVisitor

java.lang.Object
  org.codehaus.groovy.ast.CodeVisitorSupport
      org.codehaus.groovy.ast.ClassCodeVisitorSupport
          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.

Authors:
Cedric Champeau
Jochen Theodorou


Nested Class Summary
static class StaticTypeCheckingVisitor.SignatureCodecFactory

protected class StaticTypeCheckingVisitor.VariableExpressionTypeMemoizer

 
Field Summary
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 EMPTY_METHODNODE_LIST

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 TYPECHECKED_CLASSNODE

protected static ClassNode[] TYPECHECKING_ANNOTATIONS

protected static ClassNode TYPECHECKING_INFO_NODE

protected DefaultTypeCheckingExtension extension

protected ReturnAdder returnAdder

protected ReturnStatementListener returnListener

protected TypeCheckingContext typeCheckingContext

 
Constructor Summary
StaticTypeCheckingVisitor(SourceUnit source, ClassNode cn)

 
Method Summary
protected void addAmbiguousErrorMessage(List 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)

protected void addError(String msg, ASTNode expr)

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

protected void addReceivers(List receivers, Collection 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 foundMethods, String name, ClassNode[] args)

protected boolean checkCast(ClassNode targetType, Expression source)

protected void checkClosureParameters(Expression callArguments, ClassNode receiver)

visit a method call target, to infer the type.

protected void checkForbiddenSpreadArgument(ArgumentListExpression argumentList)

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

Checks that a constructor style expression is valid regarding the number of arguments and the argument types.

protected void checkGroovyStyleConstructor(ClassNode node, ClassNode[] arguments)

Checks whether a property exists on the receiver, or on any of the possible receiver classes (found in the temporary type information table)

protected ClassNode checkReturnType(ReturnStatement statement)

protected void collectAllInterfaceMethodsByName(ClassNode receiver, String name, List methods)

protected boolean existsProperty(PropertyExpression pexp, boolean checkForReadOnly)

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

static String extractPropertyNameFromMethodName(String prefix, String methodName)

Stores the inferred return type of a closure or a method.

protected Object extractTemporaryTypeInfoKey(Expression expression)

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

protected ClassNode findCurrentInstanceOfClass(Expression expr, ClassNode type)

protected List findMethod(ClassNode receiver, String name, ClassNode... args)

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

protected List findMethodsWithGenerated(ClassNode receiver, String name)

protected static String formatArgumentList(ClassNode[] nodes)

Returns a wrapped type if, and only if, the provided class node is a primitive type.

protected static GenericsType fullyResolve(GenericsType gt, Map placeholders)

protected static ClassNode fullyResolveType(ClassNode type, Map placeholders)

protected ClassNode[] getArgumentTypes(ArgumentListExpression args)

protected DelegationMetadata getDelegationMetadata(ClosureExpression expression)

protected static ClassNode getGroupOperationResultType(ClassNode a, ClassNode b)

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 ClassNode getInferredReturnType(ASTNode exp)

protected ClassNode getInferredReturnTypeFromWithClosureArgument(Expression callArguments)

protected ClassNode getOriginalDeclarationType(Expression lhs)

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

protected SourceUnit getSourceUnit()

protected List getTemporaryTypesForExpression(Expression objectExpression)

protected ClassNode getType(ASTNode exp)

protected ClassNode[] getTypeCheckingAnnotations()

TypeCheckingContext getTypeCheckingContext()

Returns the current type checking context.

protected static boolean hasRHSIncompleteGenericTypeInfo(ClassNode inferredRightExpressionType)

When instanceof checks are found in the code, we store temporary type information data in the TypeCheckingContext.temporaryIfBranchTypeInformation table.

protected StaticTypeCheckingVisitor.SetterInfo hasSetter(PropertyExpression pexp)

protected ClassNode inferComponentType(ClassNode containerType, ClassNode indexType)

protected void inferDiamondType(ConstructorCallExpression cce, ClassNode lType)

protected ClassNode inferListExpressionType(ListExpression list)

static ClassNode inferLoopElementType(ClassNode collectionType)

protected ClassNode inferMapExpressionType(MapExpression map)

protected ClassNode inferReturnTypeGenerics(ClassNode receiver, MethodNode method, Expression 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 varOrigType, Map oldTracker)

boolean isSkipMode(AnnotatedNode node)

protected boolean isSkippedInnerClass(AnnotatedNode node)

Test if a node is an inner class node, and if it is, then checks if the enclosing method is skipped.

protected List makeOwnerList(Expression objectExpression)

void performSecondPass()

protected Map popAssignmentTracking(Map oldTracker)

protected static String prettyPrintMethodList(List nodes)

protected Map pushAssignmentTracking()

protected void pushInstanceOfTypeInfo(Expression objectOfInstanceOf, Expression typeExpression)

Stores information about types when [objectOfInstanceof instanceof typeExpression] is visited

protected void restoreVariableExpressionMetadata(Map typesBeforeVisit)

protected void saveVariableExpressionMetadata(Set closureSharedExpressions, Map typesBeforeVisit)

void setMethodsToBeVisited(Set methodsToBeVisited)

protected boolean shouldSkipClassNode(ClassNode node)

protected boolean shouldSkipMethodNode(MethodNode node)

protected void silentlyVisitMethodNode(MethodNode directMethodCallCandidate)

protected void startMethodInference(MethodNode node, ErrorCollector collector)

protected ClassNode storeInferredReturnType(ASTNode node, ClassNode type)

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

protected void typeCheckClosureCall(Expression callArguments, ClassNode[] args, Parameter[] parameters)

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

protected boolean typeCheckMethodArgumentWithGenerics(ClassNode parameterType, ClassNode argumentType, boolean lastArg)

protected void typeCheckMethodsWithGenerics(ClassNode receiver, ClassNode[] arguments, MethodNode candidateMethod, Expression location)

void visitAttributeExpression(AttributeExpression expression)

void visitBinaryExpression(BinaryExpression expression)

void visitBitwiseNegationExpression(BitwiseNegationExpression expression)

void visitCaseStatement(CaseStatement statement)

void visitCastExpression(CastExpression expression)

void visitClass(ClassNode node)

void visitClassExpression(ClassExpression expression)

void visitClosureExpression(ClosureExpression expression)

void visitConstructorCallExpression(ConstructorCallExpression call)

protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)

void visitField(FieldNode node)

Given a loop collection type, returns the inferred type of the loop element.

void visitForLoop(ForStatement forLoop)

void visitIfElse(IfStatement ifElse)

void visitMethod(MethodNode node)

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

void visitMethodCallExpression(MethodCallExpression call)

void visitPostfixExpression(PostfixExpression expression)

void visitPrefixExpression(PrefixExpression expression)

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)

 
Methods inherited from class ClassCodeVisitorSupport
visitMethod, visitField, visitReturnStatement, visitProperty, visitConstructor, visitForLoop, visitSwitch, visitWhileLoop, visitDoWhileLoop, visitExpressionStatement, visitBlockStatement, visitPackage, visitClass, visitAnnotations, visitCatchStatement, visitIfElse, visitAssertStatement, visitCaseStatement, visitSynchronizedStatement, visitThrowStatement, visitImports, visitDeclarationExpression, visitBreakStatement, visitContinueStatement, visitTryCatchFinally, visitClassExpression, visitConstantExpression, visitListExpression, visitPropertyExpression, visitMethodCallExpression, visitStaticMethodCallExpression, visitConstructorCallExpression, visitBinaryExpression, visitTernaryExpression, visitShortTernaryExpression, visitPostfixExpression, visitPrefixExpression, visitBooleanExpression, visitNotExpression, visitClosureExpression, visitTupleExpression, visitArrayExpression, visitMapExpression, visitMapEntryExpression, visitRangeExpression, visitSpreadExpression, visitSpreadMapExpression, visitMethodPointerExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitBitwiseNegationExpression, visitCastExpression, visitVariableExpression, visitAttributeExpression, visitFieldExpression, visitGStringExpression, visitArgumentlistExpression, visitClosureListExpression, visitBytecodeExpression, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 
Methods inherited from class CodeVisitorSupport
visitClassExpression, visitConstantExpression, visitListExpression, visitReturnStatement, visitPropertyExpression, visitForLoop, visitSwitch, visitWhileLoop, visitDoWhileLoop, visitExpressionStatement, visitBlockStatement, visitCatchStatement, visitIfElse, visitAssertStatement, visitCaseStatement, visitSynchronizedStatement, visitThrowStatement, visitDeclarationExpression, visitBreakStatement, visitContinueStatement, visitTryCatchFinally, visitMethodCallExpression, visitStaticMethodCallExpression, visitConstructorCallExpression, visitBinaryExpression, visitTernaryExpression, visitShortTernaryExpression, visitPostfixExpression, visitPrefixExpression, visitBooleanExpression, visitNotExpression, visitClosureExpression, visitTupleExpression, visitArrayExpression, visitMapExpression, visitMapEntryExpression, visitRangeExpression, visitSpreadExpression, visitSpreadMapExpression, visitMethodPointerExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitBitwiseNegationExpression, visitCastExpression, visitVariableExpression, visitAttributeExpression, visitFieldExpression, visitGStringExpression, visitArgumentlistExpression, visitClosureListExpression, visitBytecodeExpression, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

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


CURRENT_SIGNATURE_PROTOCOL

protected static final Expression CURRENT_SIGNATURE_PROTOCOL


CURRENT_SIGNATURE_PROTOCOL_VERSION

protected static final int CURRENT_SIGNATURE_PROTOCOL_VERSION


DELEGATES_TO

protected static final ClassNode DELEGATES_TO


DELEGATES_TO_TARGET

protected static final ClassNode DELEGATES_TO_TARGET


DGM_CLASSNODE

protected static final ClassNode DGM_CLASSNODE


EMPTY_METHODNODE_LIST

protected static final List EMPTY_METHODNODE_LIST


ERROR_COLLECTOR

protected static final Object ERROR_COLLECTOR


GENERATED_EMPTY_STATEMENT

public static final Statement GENERATED_EMPTY_STATEMENT


GET_DELEGATE

protected static final MethodNode GET_DELEGATE


GET_OWNER

protected static final MethodNode GET_OWNER


GET_THISOBJECT

protected static final MethodNode GET_THISOBJECT


ITERABLE_TYPE

protected static final ClassNode ITERABLE_TYPE


LINKEDHASHMAP_CLASSNODE

protected static final ClassNode LINKEDHASHMAP_CLASSNODE


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


extension

protected DefaultTypeCheckingExtension extension


returnAdder

protected final ReturnAdder returnAdder


returnListener

protected final ReturnStatementListener returnListener


typeCheckingContext

protected TypeCheckingContext typeCheckingContext


 
Constructor Detail

StaticTypeCheckingVisitor

public StaticTypeCheckingVisitor(SourceUnit source, ClassNode cn)


 
Method Detail

addAmbiguousErrorMessage

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


addAssignmentError

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


addCategoryMethodCallError

protected void addCategoryMethodCallError(Expression call)


addClosureReturnType

protected void addClosureReturnType(ClassNode returnType)


addError

@Override}
protected void addError(String msg, ASTNode expr)


addNoMatchingMethodError

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


addReceivers

protected void addReceivers(List receivers, Collection owners, boolean implicitThis)


addStaticTypeError

protected void addStaticTypeError(String msg, ASTNode expr)


addTypeCheckingExtension

public void addTypeCheckingExtension(TypeCheckingExtension extension)


addTypeCheckingInfoAnnotation

protected void addTypeCheckingInfoAnnotation(MethodNode node)


addUnsupportedPreOrPostfixExpressionError

protected void addUnsupportedPreOrPostfixExpressionError(Expression expression)


areCategoryMethodCalls

protected boolean areCategoryMethodCalls(List foundMethods, String name, ClassNode[] args)


checkCast

protected boolean checkCast(ClassNode targetType, Expression source)


checkClosureParameters

protected void checkClosureParameters(Expression callArguments, ClassNode receiver)
visit a method call target, to infer the type. Don't report errors right away, that will be done by a later visitMethod call


checkForbiddenSpreadArgument

protected void checkForbiddenSpreadArgument(ArgumentListExpression argumentList)


checkGroovyConstructorMap

protected void checkGroovyConstructorMap(Expression receiver, ClassNode receiverType, MapExpression mapExpression)
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 void checkGroovyStyleConstructor(ClassNode node, ClassNode[] arguments)
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


checkReturnType

protected ClassNode checkReturnType(ReturnStatement statement)


collectAllInterfaceMethodsByName

protected void collectAllInterfaceMethodsByName(ClassNode receiver, String name, List methods)


existsProperty

protected boolean existsProperty(PropertyExpression pexp, boolean checkForReadOnly)


existsProperty

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


extractPropertyNameFromMethodName

public static String extractPropertyNameFromMethodName(String prefix, String methodName)
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


extractTemporaryTypeInfoKey

protected Object extractTemporaryTypeInfoKey(Expression expression)


extractTypesFromParameters

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


findCurrentInstanceOfClass

protected ClassNode findCurrentInstanceOfClass(Expression expr, ClassNode type)


findMethod

protected List findMethod(ClassNode receiver, String name, ClassNode... args)


findMethodOrFail

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


findMethodsWithGenerated

protected List findMethodsWithGenerated(ClassNode receiver, String name)


formatArgumentList

protected static String formatArgumentList(ClassNode[] nodes)
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.
Parameters:
type
Returns:
the wrapped type


fullyResolve

protected static GenericsType fullyResolve(GenericsType gt, Map placeholders)


fullyResolveType

protected static ClassNode fullyResolveType(ClassNode type, Map placeholders)


getArgumentTypes

protected ClassNode[] getArgumentTypes(ArgumentListExpression args)


getDelegationMetadata

protected DelegationMetadata getDelegationMetadata(ClosureExpression expression)


getGroupOperationResultType

protected static ClassNode getGroupOperationResultType(ClassNode a, ClassNode b)
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


getInferredReturnType

protected ClassNode getInferredReturnType(ASTNode exp)


getInferredReturnTypeFromWithClosureArgument

protected ClassNode getInferredReturnTypeFromWithClosureArgument(Expression callArguments)


getOriginalDeclarationType

protected ClassNode getOriginalDeclarationType(Expression lhs)


getResultType

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


getSourceUnit

protected SourceUnit getSourceUnit()


getTemporaryTypesForExpression

protected List getTemporaryTypesForExpression(Expression objectExpression)


getType

protected ClassNode getType(ASTNode exp)


getTypeCheckingAnnotations

protected ClassNode[] getTypeCheckingAnnotations()


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


hasRHSIncompleteGenericTypeInfo

protected static boolean hasRHSIncompleteGenericTypeInfo(ClassNode inferredRightExpressionType)
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


hasSetter

@Deprecatedsuper.visitForLoop(forLoop);
protected StaticTypeCheckingVisitor.SetterInfo hasSetter(PropertyExpression pexp)


inferComponentType

protected ClassNode inferComponentType(ClassNode containerType, ClassNode indexType)


inferDiamondType

protected void inferDiamondType(ConstructorCallExpression cce, ClassNode lType)


inferListExpressionType

protected ClassNode inferListExpressionType(ListExpression list)


inferLoopElementType

public static ClassNode inferLoopElementType(ClassNode collectionType)


inferMapExpressionType

protected ClassNode inferMapExpressionType(MapExpression map)


inferReturnTypeGenerics

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


initialize

public void initialize()


isClassInnerClassOrEqualTo

protected static boolean isClassInnerClassOrEqualTo(ClassNode toBeChecked, ClassNode start)


isClosureCall

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


isNullConstant

protected static boolean isNullConstant(Expression expression)


isSecondPassNeededForControlStructure

protected boolean isSecondPassNeededForControlStructure(Map varOrigType, Map oldTracker)


isSkipMode

public boolean isSkipMode(AnnotatedNode node)


isSkippedInnerClass

protected boolean isSkippedInnerClass(AnnotatedNode node)
Test if a node is an inner class node, and if it is, then checks if the enclosing method is skipped.
Parameters:
node
Returns:
true if the inner class node should be skipped


makeOwnerList

protected List makeOwnerList(Expression objectExpression)


performSecondPass

public void performSecondPass()


popAssignmentTracking

protected Map popAssignmentTracking(Map oldTracker)


prettyPrintMethodList

protected static String prettyPrintMethodList(List nodes)


pushAssignmentTracking

protected Map pushAssignmentTracking()


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


restoreVariableExpressionMetadata

protected void restoreVariableExpressionMetadata(Map typesBeforeVisit)


saveVariableExpressionMetadata

protected void saveVariableExpressionMetadata(Set closureSharedExpressions, Map typesBeforeVisit)


setMethodsToBeVisited

public void setMethodsToBeVisited(Set methodsToBeVisited)


shouldSkipClassNode

protected boolean shouldSkipClassNode(ClassNode node)


shouldSkipMethodNode

protected boolean shouldSkipMethodNode(MethodNode node)


silentlyVisitMethodNode

protected void silentlyVisitMethodNode(MethodNode directMethodCallCandidate)


startMethodInference

protected void startMethodInference(MethodNode node, ErrorCollector collector)


storeInferredReturnType

protected ClassNode storeInferredReturnType(ASTNode node, ClassNode type)


storeInferredTypeForPropertyExpression

protected void storeInferredTypeForPropertyExpression(PropertyExpression pexp, ClassNode flatInferredType)


storeTargetMethod

protected void storeTargetMethod(Expression call, MethodNode directMethodCallCandidate)


storeType

protected void storeType(Expression exp, ClassNode cn)


typeCheckAssignment

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


typeCheckClosureCall

protected void typeCheckClosureCall(Expression callArguments, ClassNode[] args, Parameter[] parameters)


typeCheckMapConstructor

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


typeCheckMethodArgumentWithGenerics

protected boolean typeCheckMethodArgumentWithGenerics(ClassNode parameterType, ClassNode argumentType, boolean lastArg)


typeCheckMethodsWithGenerics

protected void typeCheckMethodsWithGenerics(ClassNode receiver, ClassNode[] arguments, MethodNode candidateMethod, Expression location)


visitAttributeExpression

@Override
public void visitAttributeExpression(AttributeExpression expression)


visitBinaryExpression

@OverrideSetterInfo setterInfo = removeSetterInfo(leftExpression);
public void visitBinaryExpression(BinaryExpression expression)


visitBitwiseNegationExpression

@Override}
public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)


visitCaseStatement

@Overrideif (cn == UNKNOWN_PARAMETER_TYPE) {
public void visitCaseStatement(CaseStatement statement)


visitCastExpression

@Override}
public void visitCastExpression(CastExpression expression)


visitClass

@Overrideif (shouldSkipClassNode(node)) return;
public void visitClass(ClassNode node)


visitClassExpression

@Override}
public void visitClassExpression(ClassExpression expression)


visitClosureExpression

@Overridefor (VariableExpression ve : closureSharedExpressions) {
public void visitClosureExpression(ClosureExpression expression)


visitConstructorCallExpression

@Override
public void visitConstructorCallExpression(ConstructorCallExpression call)


visitConstructorOrMethod

@Override&& findMethod(receiver, "", args).isEmpty()) {
protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)


visitField

@Overrideif (collectionType.implementsInterface(ITERABLE_TYPE)) {
public void visitField(FieldNode node)
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


visitForLoop

@Overridereturn false;
public void visitForLoop(ForStatement forLoop)


visitIfElse

@OverrideClassNode resultType;
public void visitIfElse(IfStatement ifElse)


visitMethod

@Override
public void visitMethod(MethodNode node)


visitMethodCallArguments

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


visitMethodCallExpression

@OverrideParameter[] parameters = ((ClosureExpression) objectExpression).getParameters();
public void visitMethodCallExpression(MethodCallExpression call)


visitPostfixExpression

@OverrideresultType = mn.getReturnType();
public void visitPostfixExpression(PostfixExpression expression)


visitPrefixExpression

@Override
public void visitPrefixExpression(PrefixExpression expression)


visitPropertyExpression

@Override}
public void visitPropertyExpression(PropertyExpression pexp)


visitRangeExpression

@Override}
public void visitRangeExpression(RangeExpression expression)


visitReturnStatement

@Overridenode = typeCheckMapConstructor(call, receiver, arguments);
public void visitReturnStatement(ReturnStatement statement)


visitStaticMethodCallExpression

@Overrideif (parameters.length > 1) {
public void visitStaticMethodCallExpression(StaticMethodCallExpression call)


visitSwitch

@Override}
public void visitSwitch(SwitchStatement statement)


visitTernaryExpression

@OverrideMethodNode method = findMethodOrFail(newExpr, left.getPlainNodeReference(), "getAt", right.getPlainNodeReference());
public void visitTernaryExpression(TernaryExpression expression)


visitTryCatchFinally

@Overrideif (isFloatingCategory(leftRedirect) || isFloatingCategory(rightRedirect)) {
public void visitTryCatchFinally(TryCatchStatement statement)


visitUnaryMinusExpression

@OverrideresultType = type;
public void visitUnaryMinusExpression(UnaryMinusExpression expression)


visitUnaryPlusExpression

@Override
public void visitUnaryPlusExpression(UnaryPlusExpression expression)


visitVariableExpression

@Override
public void visitVariableExpression(VariableExpression vexp)


visitWhileLoop

@Overrideif (!isPrimitiveType(exprType)) {
public void visitWhileLoop(WhileStatement loop)


wrapTypeIfNecessary

protected static ClassNode wrapTypeIfNecessary(ClassNode type)


 

Copyright © 2003-2013 The Codehaus. All rights reserved.