Class AbstractTypeCheckingExtension
- java.lang.Object
- 
- org.codehaus.groovy.transform.stc.TypeCheckingExtension
- 
- org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension
 
 
- 
- Direct Known Subclasses:
- GroovyTypeCheckingExtensionSupport,- TraitTypeCheckingExtension
 
 public class AbstractTypeCheckingExtension extends TypeCheckingExtension Custom type checking extensions may extend this method in order to benefit from a lot of support methods. The methods found in this class are made directly available in type checking scripts through the GroovyTypeCheckingExtensionSupportclass.- Since:
- 2.3.0
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected TypeCheckingContextcontextprotected booleandebugprotected booleanhandled- 
Fields inherited from class org.codehaus.groovy.transform.stc.TypeCheckingExtensiontypeCheckingVisitor
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanargTypeMatches(ClassNode[] argTypes, int index, java.lang.Class clazz)booleanargTypeMatches(MethodCall call, int index, java.lang.Class clazz)booleanargTypesMatches(ClassNode[] argTypes, java.lang.Class... classes)booleanargTypesMatches(MethodCall call, java.lang.Class... classes)voiddelegatesTo(ClassNode type)voiddelegatesTo(ClassNode type, int strategy)voiddelegatesTo(ClassNode type, int strategy, org.codehaus.groovy.transform.stc.DelegationMetadata parent)booleanfirstArgTypesMatches(ClassNode[] argTypes, java.lang.Class... classes)booleanfirstArgTypesMatches(MethodCall call, java.lang.Class... classes)ArgumentListExpressiongetArguments(MethodCall call)org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScopegetCurrentScope()BinaryExpressiongetEnclosingBinaryExpression()java.util.List<BinaryExpression>getEnclosingBinaryExpressionStack()ClassNodegetEnclosingClassNode()java.util.List<ClassNode>getEnclosingClassNodes()TypeCheckingContext.EnclosingClosuregetEnclosingClosure()java.util.List<TypeCheckingContext.EnclosingClosure>getEnclosingClosureStack()MethodNodegetEnclosingMethod()ExpressiongetEnclosingMethodCall()java.util.List<Expression>getEnclosingMethodCalls()java.util.List<MethodNode>getEnclosingMethods()java.util.Set<MethodNode>getGeneratedMethods()booleanisAnnotatedBy(ASTNode node, java.lang.Class annotation)booleanisAnnotatedBy(ASTNode node, ClassNode annotation)booleanisDynamic(VariableExpression var)booleanisExtensionMethod(MethodNode node)booleanisGenerated(MethodNode node)booleanisMethodCall(java.lang.Object o)voidlog(java.lang.String message)MethodNodemakeDynamic(MethodCall call)Used to instruct the type checker that the call is a dynamic method call.MethodNodemakeDynamic(MethodCall call, ClassNode returnType)Used to instruct the type checker that the call is a dynamic method call.voidmakeDynamic(PropertyExpression pexp)Instructs the type checker that a property access is dynamic, returning an instance of an Object.voidmakeDynamic(PropertyExpression pexp, ClassNode returnType)Instructs the type checker that a property access is dynamic.voidmakeDynamic(VariableExpression vexp)Instructs the type checker that an unresolved variable is a dynamic variable of type Object.voidmakeDynamic(VariableExpression vexp, ClassNode returnType)Instructs the type checker that an unresolved variable is a dynamic variable.MethodNodenewMethod(java.lang.String name, java.lang.Class returnType)MethodNodenewMethod(java.lang.String name, java.util.concurrent.Callable<ClassNode> returnType)MethodNodenewMethod(java.lang.String name, ClassNode returnType)org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScopenewScope()org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScopenewScope(Closure code)BinaryExpressionpopEnclosingBinaryExpression()ClassNodepopEnclosingClassNode()TypeCheckingContext.EnclosingClosurepopEnclosingClosure()MethodNodepopEnclosingMethod()ExpressionpopEnclosingMethodCall()voidpopTemporaryTypeInfo()voidpushEnclosingBinaryExpression(BinaryExpression binaryExpression)voidpushEnclosingClassNode(ClassNode classNode)voidpushEnclosingClosureExpression(ClosureExpression closureExpression)voidpushEnclosingMethod(MethodNode methodNode)voidpushEnclosingMethodCall(Expression call)voidpushTemporaryTypeInfo()protected java.lang.ObjectsafeCall(Closure closure, java.lang.Object... args)org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScopescopeExit()org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScopescopeExit(Closure code)voidsetHandled(boolean handled)java.util.List<MethodNode>unique(MethodNode node)<R> RwithTypeChecker(Closure<R> code)- 
Methods inherited from class org.codehaus.groovy.transform.stc.TypeCheckingExtensionaddStaticTypeError, afterMethodCall, afterVisitClass, afterVisitMethod, beforeMethodCall, beforeVisitClass, beforeVisitMethod, buildListType, buildMapType, classNodeFor, classNodeFor, existsProperty, existsProperty, extractStaticReceiver, finish, getArgumentTypes, getTargetMethod, getType, handleAmbiguousMethods, handleIncompatibleAssignment, handleIncompatibleReturnType, handleMissingMethod, handleUnresolvedAttribute, handleUnresolvedProperty, handleUnresolvedVariableExpression, isStaticMethodCallOnClass, lookupClassNodeFor, onMethodSelection, parameterizedType, setup, storeType
 
- 
 
- 
- 
- 
Field Detail- 
contextprotected final TypeCheckingContext context 
 - 
handledprotected boolean handled 
 - 
debugprotected boolean debug 
 
- 
 - 
Constructor Detail- 
AbstractTypeCheckingExtensionpublic AbstractTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor) 
 
- 
 - 
Method Detail- 
setHandledpublic void setHandled(boolean handled) 
 - 
newScopepublic org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScope newScope() 
 - 
newScopepublic org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScope newScope(Closure code) 
 - 
scopeExitpublic org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScope scopeExit() 
 - 
getCurrentScopepublic org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScope getCurrentScope() 
 - 
scopeExitpublic org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension.TypeCheckingScope scopeExit(Closure code) 
 - 
isGeneratedpublic boolean isGenerated(MethodNode node) 
 - 
uniquepublic java.util.List<MethodNode> unique(MethodNode node) 
 - 
newMethodpublic MethodNode newMethod(java.lang.String name, java.lang.Class returnType) 
 - 
newMethodpublic MethodNode newMethod(java.lang.String name, ClassNode returnType) 
 - 
newMethodpublic MethodNode newMethod(java.lang.String name, java.util.concurrent.Callable<ClassNode> returnType) 
 - 
delegatesTopublic void delegatesTo(ClassNode type) 
 - 
delegatesTopublic void delegatesTo(ClassNode type, int strategy) 
 - 
delegatesTopublic void delegatesTo(ClassNode type, int strategy, org.codehaus.groovy.transform.stc.DelegationMetadata parent) 
 - 
isAnnotatedBypublic boolean isAnnotatedBy(ASTNode node, java.lang.Class annotation) 
 - 
isDynamicpublic boolean isDynamic(VariableExpression var) 
 - 
isExtensionMethodpublic boolean isExtensionMethod(MethodNode node) 
 - 
getArgumentspublic ArgumentListExpression getArguments(MethodCall call) 
 - 
safeCallprotected java.lang.Object safeCall(Closure closure, java.lang.Object... args) 
 - 
isMethodCallpublic boolean isMethodCall(java.lang.Object o) 
 - 
argTypesMatchespublic boolean argTypesMatches(ClassNode[] argTypes, java.lang.Class... classes) 
 - 
argTypesMatchespublic boolean argTypesMatches(MethodCall call, java.lang.Class... classes) 
 - 
firstArgTypesMatchespublic boolean firstArgTypesMatches(ClassNode[] argTypes, java.lang.Class... classes) 
 - 
firstArgTypesMatchespublic boolean firstArgTypesMatches(MethodCall call, java.lang.Class... classes) 
 - 
argTypeMatchespublic boolean argTypeMatches(ClassNode[] argTypes, int index, java.lang.Class clazz) 
 - 
argTypeMatchespublic boolean argTypeMatches(MethodCall call, int index, java.lang.Class clazz) 
 - 
withTypeCheckerpublic <R> R withTypeChecker(Closure<R> code) 
 - 
makeDynamicpublic MethodNode makeDynamic(MethodCall call) Used to instruct the type checker that the call is a dynamic method call. Calling this method automatically sets the handled flag to true. The expected return type of the dynamic method call is Object.- Parameters:
- call- the method call which is a dynamic method call
- Returns:
- a virtual method node with the same name as the expected call
 
 - 
makeDynamicpublic MethodNode makeDynamic(MethodCall call, ClassNode returnType) Used to instruct the type checker that the call is a dynamic method call. Calling this method automatically sets the handled flag to true.- Parameters:
- call- the method call which is a dynamic method call
- returnType- the expected return type of the dynamic call
- Returns:
- a virtual method node with the same name as the expected call
 
 - 
makeDynamicpublic void makeDynamic(PropertyExpression pexp) Instructs the type checker that a property access is dynamic, returning an instance of an Object. Calling this method automatically sets the handled flag to true.- Parameters:
- pexp- the property or attribute expression
 
 - 
makeDynamicpublic void makeDynamic(PropertyExpression pexp, ClassNode returnType) Instructs the type checker that a property access is dynamic. Calling this method automatically sets the handled flag to true.- Parameters:
- pexp- the property or attribute expression
- returnType- the type of the property
 
 - 
makeDynamicpublic void makeDynamic(VariableExpression vexp) Instructs the type checker that an unresolved variable is a dynamic variable of type Object. Calling this method automatically sets the handled flag to true.- Parameters:
- vexp- the dynamic variable
 
 - 
makeDynamicpublic void makeDynamic(VariableExpression vexp, ClassNode returnType) Instructs the type checker that an unresolved variable is a dynamic variable.- Parameters:
- returnType- the type of the dynamic variable Calling this method automatically sets the handled flag to true.
- vexp- the dynamic variable
 
 - 
logpublic void log(java.lang.String message) 
 - 
getEnclosingBinaryExpressionpublic BinaryExpression getEnclosingBinaryExpression() 
 - 
pushEnclosingBinaryExpressionpublic void pushEnclosingBinaryExpression(BinaryExpression binaryExpression) 
 - 
pushEnclosingClosureExpressionpublic void pushEnclosingClosureExpression(ClosureExpression closureExpression) 
 - 
getEnclosingMethodCallpublic Expression getEnclosingMethodCall() 
 - 
popEnclosingMethodCallpublic Expression popEnclosingMethodCall() 
 - 
popEnclosingMethodpublic MethodNode popEnclosingMethod() 
 - 
getEnclosingClassNodepublic ClassNode getEnclosingClassNode() 
 - 
getEnclosingMethodspublic java.util.List<MethodNode> getEnclosingMethods() 
 - 
getEnclosingMethodpublic MethodNode getEnclosingMethod() 
 - 
popTemporaryTypeInfopublic void popTemporaryTypeInfo() 
 - 
pushEnclosingClassNodepublic void pushEnclosingClassNode(ClassNode classNode) 
 - 
popEnclosingBinaryExpressionpublic BinaryExpression popEnclosingBinaryExpression() 
 - 
getEnclosingClassNodespublic java.util.List<ClassNode> getEnclosingClassNodes() 
 - 
getEnclosingClosureStackpublic java.util.List<TypeCheckingContext.EnclosingClosure> getEnclosingClosureStack() 
 - 
popEnclosingClassNodepublic ClassNode popEnclosingClassNode() 
 - 
pushEnclosingMethodpublic void pushEnclosingMethod(MethodNode methodNode) 
 - 
getGeneratedMethodspublic java.util.Set<MethodNode> getGeneratedMethods() 
 - 
getEnclosingBinaryExpressionStackpublic java.util.List<BinaryExpression> getEnclosingBinaryExpressionStack() 
 - 
getEnclosingClosurepublic TypeCheckingContext.EnclosingClosure getEnclosingClosure() 
 - 
getEnclosingMethodCallspublic java.util.List<Expression> getEnclosingMethodCalls() 
 - 
pushEnclosingMethodCallpublic void pushEnclosingMethodCall(Expression call) 
 - 
popEnclosingClosurepublic TypeCheckingContext.EnclosingClosure popEnclosingClosure() 
 - 
pushTemporaryTypeInfopublic void pushTemporaryTypeInfo() 
 
- 
 
-