|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.transform.stc.StaticTypeCheckingSupport
public abstract class StaticTypeCheckingSupport extends java.lang.Object
Static support methods for StaticTypeCheckingVisitor.
Field Summary | |
---|---|
protected static ClassNode |
ArrayList_TYPE
|
protected static ClassNode |
Collection_TYPE
|
protected static java.util.Comparator |
DGM_METHOD_NODE_COMPARATOR
This comparator is used when we return the list of methods from DGM which name correspond to a given name. |
protected static ClassNode |
Deprecated_TYPE
|
protected static StaticTypeCheckingSupport.ExtensionMethodCache |
EXTENSION_METHOD_CACHE
|
protected static ClassNode |
GSTRING_STRING_CLASSNODE
|
protected static ClassNode |
Matcher_TYPE
|
protected static java.util.Map |
NUMBER_TYPES
|
protected static ClassNode |
UNKNOWN_PARAMETER_TYPE
This is for internal use only. |
Method Summary | |
---|---|
static int
|
allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args)
Checks that arguments and parameter types match. |
static boolean
|
checkCompatibleAssignmentTypes(ClassNode left, ClassNode right)
Returns true or false depending on whether the right classnode can be assigned to the left classnode. |
static boolean
|
checkCompatibleAssignmentTypes(ClassNode left, ClassNode right, Expression rightExpression)
|
static java.util.List
|
chooseBestMethod(ClassNode receiver, java.util.Collection methods, ClassNode... args)
Given a list of candidate methods, returns the one which best matches the argument types |
static java.lang.Object
|
evaluateExpression(Expression expr)
|
static java.util.List
|
findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args)
|
static java.util.List
|
findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args, java.util.List methods)
|
protected static java.util.Set
|
findDGMMethodsForClassNode(ClassNode clazz, java.lang.String name)
|
protected static void
|
findDGMMethodsForClassNode(ClassNode clazz, java.lang.String name, java.util.TreeSet accumulator)
|
protected static Variable
|
findTargetVariable(VariableExpression ve)
Given a variable expression, returns the ultimately accessed variable. |
static boolean
|
implementsInterfaceOrIsSubclassOf(ClassNode type, ClassNode superOrInterface)
|
protected static boolean
|
isArrayAccessExpression(Expression expression)
Returns true for expressions of the form x[...] |
static boolean
|
isAssignment(int op)
|
static boolean
|
isBeingCompiled(ClassNode node)
|
static boolean
|
isGStringOrGStringStringLUB(ClassNode node)
@param node the node to be tested |
static boolean
|
isParameterizedWithGStringOrGStringString(ClassNode node)
|
static boolean
|
isParameterizedWithString(ClassNode node)
|
static boolean
|
isWildcardLeftHandSide(ClassNode node)
Tells if a class is one of the "accept all" classes as the left hand side of an assignment. |
static boolean
|
isWithCall(java.lang.String name, Expression callArguments)
Called on method call checks in order to determine if a method call corresponds to the idiomatic o.with { ... } structure |
static boolean
|
missesGenericsTypes(ClassNode cn)
|
static Parameter[]
|
parameterizeArguments(ClassNode receiver, MethodNode m)
A DGM-like method which adds support for method calls which are handled specifically by the Groovy compiler. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected static final ClassNode ArrayList_TYPE
protected static final ClassNode Collection_TYPE
protected static final java.util.Comparator DGM_METHOD_NODE_COMPARATOR
protected static final ClassNode Deprecated_TYPE
protected static final StaticTypeCheckingSupport.ExtensionMethodCache EXTENSION_METHOD_CACHE
protected static final ClassNode GSTRING_STRING_CLASSNODE
protected static final ClassNode Matcher_TYPE
protected static final java.util.Map NUMBER_TYPES
protected static final ClassNode UNKNOWN_PARAMETER_TYPE
Method Detail |
---|
public static int allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args)
params
- method parametersargs
- type arguments
public static boolean checkCompatibleAssignmentTypes(ClassNode left, ClassNode right)
left
- the class to be assigned toright
- the assignee class
public static boolean checkCompatibleAssignmentTypes(ClassNode left, ClassNode right, Expression rightExpression)
public static java.util.List chooseBestMethod(ClassNode receiver, java.util.Collection methods, ClassNode... args)
methods
- candidate methodsargs
- argument types
public static java.lang.Object evaluateExpression(Expression expr)
public static java.util.List findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args)
public static java.util.List findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args, java.util.List methods)
protected static java.util.Set findDGMMethodsForClassNode(ClassNode clazz, java.lang.String name)
protected static void findDGMMethodsForClassNode(ClassNode clazz, java.lang.String name, java.util.TreeSet accumulator)
protected static Variable findTargetVariable(VariableExpression ve)
ve
- a variable expression
public static boolean implementsInterfaceOrIsSubclassOf(ClassNode type, ClassNode superOrInterface)
protected static boolean isArrayAccessExpression(Expression expression)
expression
- an expression
public static boolean isAssignment(int op)
public static boolean isBeingCompiled(ClassNode node)
public static boolean isGStringOrGStringStringLUB(ClassNode node)
node
- the node to be tested
public static boolean isParameterizedWithGStringOrGStringString(ClassNode node)
public static boolean isParameterizedWithString(ClassNode node)
public static boolean isWildcardLeftHandSide(ClassNode node)
node
- the classnode to test
public static boolean isWithCall(java.lang.String name, Expression callArguments)
name
- name of the method calledcallArguments
- arguments of the method
public static boolean missesGenericsTypes(ClassNode cn)
public static Parameter[] parameterizeArguments(ClassNode receiver, MethodNode m)
Groovy Documentation