Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.transform.stc
[Java] Class StaticTypeCheckingSupport

    java.lang.Object
      org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport

    public abstract class StaticTypeCheckingSupport
    extends java.lang.Object

Static support methods for StaticTypeCheckingVisitor.

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.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)`
`static boolean` | `implementsInterfaceOrIsSubclassOf(ClassNode type, ClassNode superOrInterface)`
`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` | `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), java.lang.Object#wait(long, int), 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()

Method Detail

### allParametersAndArgumentsMatch

    public static int allParametersAndArgumentsMatch(Parameter[] params, ClassNode[] args)

  Checks that arguments and parameter types match.
  Parameters:
    `params` - method parameters
    `args` - type arguments
  Returns:
    -1 if arguments do not match, 0 if arguments are of the exact type and >0 when one or more argument is not of the exact type but still match

### checkCompatibleAssignmentTypes

    public static boolean checkCompatibleAssignmentTypes(ClassNode left, ClassNode right)

  Returns true or false depending on whether the right classnode can be assigned to the left classnode. This method should not add errors by itself: we let the caller decide what to do if an incompatible assignment is found.
  Parameters:
    `left` - the class to be assigned to
    `right` - the assignee class
  Returns:
    false if types are incompatible

### checkCompatibleAssignmentTypes

    public static boolean checkCompatibleAssignmentTypes(ClassNode left, ClassNode right, Expression rightExpression)

### chooseBestMethod

    public 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
  Parameters:
    receiver
    `methods` - candidate methods
    `args` - argument types
  Returns:
    the list of methods which best matches the argument types. It is still possible that multiple methods match the argument types.

### findDGMMethodsByNameAndArguments

    public static java.util.List findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args)

### findDGMMethodsByNameAndArguments

    public static java.util.List findDGMMethodsByNameAndArguments(ClassNode receiver, java.lang.String name, ClassNode[] args, java.util.List methods)

### implementsInterfaceOrIsSubclassOf

    public static boolean implementsInterfaceOrIsSubclassOf(ClassNode type, ClassNode superOrInterface)

### isAssignment

    public static boolean isAssignment(int op)

### isBeingCompiled

    public static boolean isBeingCompiled(ClassNode node)

### isGStringOrGStringStringLUB

    public static boolean isGStringOrGStringStringLUB(ClassNode node)

  Parameters:
    `node` - the node to be tested
  Returns:
    true if the node is using generics types and one of those types is a string

### isParameterizedWithGStringOrGStringString

    public static boolean isParameterizedWithGStringOrGStringString(ClassNode node)

### isParameterizedWithString

    public static boolean isParameterizedWithString(ClassNode node)

### isWithCall

    public 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
  Parameters:
    `name` - name of the method called
    `callArguments` - arguments of the method
  Returns:
    true if the name is "with" and arguments consist of a single closure

### missesGenericsTypes

    public static boolean missesGenericsTypes(ClassNode cn)

### parameterizeArguments

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

Groovy Documentation