Class TraitTypeCheckingExtension
- java.lang.Object
-
- org.codehaus.groovy.transform.stc.TypeCheckingExtension
-
- org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension
-
- org.codehaus.groovy.transform.stc.TraitTypeCheckingExtension
-
public class TraitTypeCheckingExtension extends AbstractTypeCheckingExtension
A type checking extension that will take care of handling errors which are specific to traits. In particular, it will handle the "super" method calls within a trait.- Since:
- 2.3.0
-
-
Field Summary
-
Fields inherited from class org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension
context, debug, handled
-
Fields inherited from class org.codehaus.groovy.transform.stc.TypeCheckingExtension
typeCheckingVisitor
-
-
Constructor Summary
Constructors Constructor Description TraitTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)
Builds a type checking extension relying on a Groovy script (type checking DSL).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
setup()
Subclasses should implement this method whenever they need to perform special checks before the type checker starts working.-
Methods inherited from class org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension
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, withTypeChecker
-
Methods inherited from class org.codehaus.groovy.transform.stc.TypeCheckingExtension
addStaticTypeError, afterMethodCall, afterVisitClass, afterVisitMethod, beforeMethodCall, beforeVisitClass, beforeVisitMethod, buildListType, buildMapType, classNodeFor, classNodeFor, existsProperty, existsProperty, extractStaticReceiver, finish, getArgumentTypes, getTargetMethod, getType, handleAmbiguousMethods, handleIncompatibleAssignment, handleIncompatibleReturnType, handleUnresolvedAttribute, handleUnresolvedProperty, handleUnresolvedVariableExpression, isStaticMethodCallOnClass, lookupClassNodeFor, onMethodSelection, parameterizedType, storeType
-
-
-
-
Constructor Detail
-
TraitTypeCheckingExtension
public TraitTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)
Builds a type checking extension relying on a Groovy script (type checking DSL).- Parameters:
typeCheckingVisitor
- the type checking visitor
-
-
Method Detail
-
setup
public void setup()
Description copied from class:TypeCheckingExtension
Subclasses should implement this method whenever they need to perform special checks before the type checker starts working.- Overrides:
setup
in classTypeCheckingExtension
-
handleMissingMethod
public java.util.List<MethodNode> handleMissingMethod(ClassNode receiver, java.lang.String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)
Description copied from class:TypeCheckingExtension
This method is called by the type checker when a method call cannot be resolved. Extensions may override this method to handle missing methods and prevent the type checker from throwing an error.- Overrides:
handleMissingMethod
in classTypeCheckingExtension
- Parameters:
receiver
- 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 needed- Returns:
- an empty list if the extension cannot resolve the method, or a list of potential methods if the extension finds candidates. This method must not return null.
-
-