public class GroovyTypeCheckingExtensionSupport extends AbstractTypeCheckingExtension
TypeCheckingExtension,
 this class adds a number of utility methods aimed at leveraging the syntax of the Groovy language to improve
 expressivity and conciseness.| Modifier and Type | Class and Description | 
|---|---|
| static class  | GroovyTypeCheckingExtensionSupport.TypeCheckingDSL | 
context, debug, handledtypeCheckingVisitor| Constructor and Description | 
|---|
| GroovyTypeCheckingExtensionSupport(StaticTypeCheckingVisitor typeCheckingVisitor,
                                  java.lang.String scriptPath,
                                  CompilationUnit compilationUnit)Builds a type checking extension relying on a Groovy script (type checking DSL). | 
| Modifier and Type | Method and Description | 
|---|---|
| void | afterMethodCall(MethodCall call)Allows the extension to perform additional tasks after the type checker actually visits a method call. | 
| void | afterVisitClass(ClassNode node)Allows the extension to perform additional tasks after the type checker actually visited a class node. | 
| void | afterVisitMethod(MethodNode node)Allows the extension to perform additional tasks after the type checker actually visited a method node. | 
| boolean | beforeMethodCall(MethodCall call)Allows the extension to perform additional tasks before the type checker actually visits a method call. | 
| boolean | beforeVisitClass(ClassNode node)Allows the extension to perform additional tasks before the type checker actually visits a class node. | 
| boolean | beforeVisitMethod(MethodNode node)Allows the extension to perform additional tasks before the type checker actually visits a method node. | 
| void | finish()Subclasses should implement this method if they need to perform additional
 checks after the type checker has finished its work. | 
| java.util.List<MethodNode> | handleAmbiguousMethods(java.util.List<MethodNode> nodes,
                      Expression origin)This method is called by the type checker before throwing an "ambiguous method" error, giving the chance
 to the extension to select the method properly. | 
| boolean | handleIncompatibleAssignment(ClassNode lhsType,
                            ClassNode rhsType,
                            Expression assignmentExpression)This method is called by the type checker when an assignment is not allowed by the type checker. | 
| boolean | handleIncompatibleReturnType(ReturnStatement returnStatement,
                            ClassNode inferredReturnType)Allows the extension to catch incompatible return types. | 
| java.util.List<MethodNode> | handleMissingMethod(ClassNode receiver,
                   java.lang.String name,
                   ArgumentListExpression argumentList,
                   ClassNode[] argumentTypes,
                   MethodCall call)This method is called by the type checker when a method call cannot be resolved. | 
| boolean | handleUnresolvedAttribute(AttributeExpression aexp)This method is called by the type checker when an attribute expression cannot
 be resolved (for example, when an attribute doesn't exist). | 
| boolean | handleUnresolvedProperty(PropertyExpression pexp)This method is called by the type checker when a property expression cannot
 be resolved (for example, when a property doesn't exist). | 
| boolean | handleUnresolvedVariableExpression(VariableExpression vexp)This method is called by the type checker when a variable expression cannot
 be resolved. | 
| void | onMethodSelection(Expression expression,
                 MethodNode target)Allows the extension to listen to method selection events. | 
| void | setDebug(boolean debug) | 
| void | setup()Subclasses should implement this method whenever they need to perform
 special checks before the type checker starts working. | 
argTypeMatches, argTypeMatches, argTypesMatches, argTypesMatches, delegatesTo, delegatesTo, delegatesTo, firstArgTypesMatches, firstArgTypesMatches, getArguments, getCurrentScope, getEnclosingBinaryExpression, getEnclosingBinaryExpressionStack, getEnclosingClassNode, getEnclosingClassNodes, getEnclosingClosure, getEnclosingClosureStack, getEnclosingMethod, getEnclosingMethodCall, getEnclosingMethodCalls, getEnclosingMethods, getGeneratedMethods, isAnnotatedBy, isAnnotatedBy, isDynamic, isExtensionMethod, isGenerated, isMethodCall, log, makeDynamic, makeDynamic, makeDynamic, makeDynamic, makeDynamic, makeDynamic, newMethod, newMethod, newMethod, newScope, newScope, popEnclosingBinaryExpression, popEnclosingClassNode, popEnclosingClosure, popEnclosingMethod, popEnclosingMethodCall, popTemporaryTypeInfo, pushEnclosingBinaryExpression, pushEnclosingClassNode, pushEnclosingClosureExpression, pushEnclosingMethod, pushEnclosingMethodCall, pushTemporaryTypeInfo, safeCall, scopeExit, scopeExit, setHandled, unique, withTypeCheckeraddStaticTypeError, buildListType, buildMapType, classNodeFor, classNodeFor, existsProperty, existsProperty, extractStaticReceiver, getArgumentTypes, getTargetMethod, getType, isStaticMethodCallOnClass, lookupClassNodeFor, parameterizedType, storeTypepublic GroovyTypeCheckingExtensionSupport(StaticTypeCheckingVisitor typeCheckingVisitor, java.lang.String scriptPath, CompilationUnit compilationUnit)
typeCheckingVisitor - the type checking visitorscriptPath - the path to the type checking script (in classpath)compilationUnit - public void setDebug(boolean debug)
public void setup()
TypeCheckingExtensionsetup in class TypeCheckingExtensionpublic void finish()
TypeCheckingExtensionfinish in class TypeCheckingExtensionpublic void onMethodSelection(Expression expression, MethodNode target)
TypeCheckingExtensiononMethodSelection in class TypeCheckingExtensionexpression - the expression for which a corresponding method has been foundtarget - the method which has been chosen by the type checkerpublic void afterMethodCall(MethodCall call)
TypeCheckingExtensionTypeCheckingMode.SKIP.afterMethodCall in class TypeCheckingExtensioncall - a method call, either a MethodCallExpression, StaticMethodCallExpression, or ConstructorCallExpressionpublic boolean beforeMethodCall(MethodCall call)
TypeCheckingExtensionTypeCheckingMode.SKIP.beforeMethodCall in class TypeCheckingExtensioncall - a method call, either a MethodCallExpression, StaticMethodCallExpression, or ConstructorCallExpressionpublic boolean handleUnresolvedVariableExpression(VariableExpression vexp)
TypeCheckingExtensionhandleUnresolvedVariableExpression in class TypeCheckingExtensionvexp - the unresolved variable extensionboolean false if the extension doesn't handle it,
 true if the extension handles this variable.public boolean handleUnresolvedProperty(PropertyExpression pexp)
TypeCheckingExtensionhandleUnresolvedProperty in class TypeCheckingExtensionpexp - the unresolved propertyboolean false if this extension doesn't resolve the property, true
 if it resolves the property.public boolean handleUnresolvedAttribute(AttributeExpression aexp)
TypeCheckingExtensionhandleUnresolvedAttribute in class TypeCheckingExtensionaexp - the unresolved attributeboolean false if this extension doesn't resolve the attribute, true
 if it resolves the attribute.public void afterVisitMethod(MethodNode node)
TypeCheckingExtensionTypeCheckingMode.SKIP.afterVisitMethod in class TypeCheckingExtensionnode - a method nodepublic boolean beforeVisitClass(ClassNode node)
TypeCheckingExtensionTypeCheckingMode.SKIP.beforeVisitClass in class TypeCheckingExtensionnode - a class nodepublic void afterVisitClass(ClassNode node)
TypeCheckingExtensionTypeCheckingMode.SKIP.afterVisitClass in class TypeCheckingExtensionnode - a class nodepublic boolean beforeVisitMethod(MethodNode node)
TypeCheckingExtensionTypeCheckingMode.SKIP.beforeVisitMethod in class TypeCheckingExtensionnode - a method nodepublic boolean handleIncompatibleAssignment(ClassNode lhsType, ClassNode rhsType, Expression assignmentExpression)
TypeCheckingExtensionhandleIncompatibleAssignment in class TypeCheckingExtensionlhsType - the type of the left hand side of the assignment, as found by the type checkerrhsType - the type of the right hand side of the assignment, as found by the type checkerassignmentExpression - the assignment expression which triggered this callboolean false if the extension does not handle this assignment, true otherwisepublic boolean handleIncompatibleReturnType(ReturnStatement returnStatement, ClassNode inferredReturnType)
TypeCheckingExtensionhandleIncompatibleReturnType in class TypeCheckingExtensionreturnStatement - the statement that triggered the errorinferredReturnType - the inferred return type for this statementpublic java.util.List<MethodNode> handleMissingMethod(ClassNode receiver, java.lang.String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)
TypeCheckingExtensionhandleMissingMethod in class TypeCheckingExtensionreceiver - the type of the receivername - the name of the called methodargumentList - the list of arguments of the callargumentTypes - the types of the arguments of the callcall - the method call itself, if neededpublic java.util.List<MethodNode> handleAmbiguousMethods(java.util.List<MethodNode> nodes, Expression origin)
TypeCheckingExtensionhandleAmbiguousMethods in class TypeCheckingExtensionnodes - the list of ambiguous methodsorigin - the expression which originated the method selection process