Groovy 2.2.1

org.codehaus.groovy.transform.stc
[Java] Class GroovyTypeCheckingExtensionSupport

java.lang.Object
  org.codehaus.groovy.transform.stc.TypeCheckingExtension
      org.codehaus.groovy.transform.stc.GroovyTypeCheckingExtensionSupport

public class GroovyTypeCheckingExtensionSupport
extends TypeCheckingExtension

Base class for type checking extensions written in Groovy. Compared to its superclass, TypeCheckingExtension, this class adds a number of utility methods aimed at leveraging the syntax of the Groovy language to improve expressivity and conciseness.

Authors:
Cedric Champeau
Since:
2.1.0


Nested Class Summary
static class GroovyTypeCheckingExtensionSupport.TypeCheckingDSL

 
Field Summary
 
Fields inherited from class TypeCheckingExtension
typeCheckingVisitor
 
Constructor Summary
GroovyTypeCheckingExtensionSupport(StaticTypeCheckingVisitor typeCheckingVisitor, String scriptPath, CompilationUnit compilationUnit)

 
Method Summary
void afterMethodCall(MethodCall call)

void afterVisitClass(ClassNode node)

void afterVisitMethod(MethodNode node)

boolean argTypeMatches(ClassNode[] argTypes, int index, Class clazz)

boolean argTypeMatches(MethodCall call, int index, Class clazz)

boolean argTypesMatches(ClassNode[] argTypes, Class... classes)

boolean argTypesMatches(MethodCall call, Class... classes)

boolean beforeMethodCall(MethodCall call)

boolean beforeVisitClass(ClassNode node)

boolean beforeVisitMethod(MethodNode node)

void delegatesTo(ClassNode type)

void delegatesTo(ClassNode type, int strategy)

void delegatesTo(ClassNode type, int strategy, DelegationMetadata parent)

void finish()

boolean firstArgTypesMatches(ClassNode[] argTypes, Class... classes)

boolean firstArgTypesMatches(MethodCall call, Class... classes)

ArgumentListExpression getArguments(MethodCall call)

GroovyTypeCheckingExtensionSupport.TypeCheckingScope getCurrentScope()

BinaryExpression getEnclosingBinaryExpression()

List getEnclosingBinaryExpressionStack()

ClassNode getEnclosingClassNode()

List getEnclosingClassNodes()

EnclosingClosure getEnclosingClosure()

List getEnclosingClosureStack()

MethodNode getEnclosingMethod()

Expression getEnclosingMethodCall()

List getEnclosingMethodCalls()

List getEnclosingMethods()

List handleAmbiguousMethods(List nodes, Expression origin)

boolean handleIncompatibleAssignment(ClassNode lhsType, ClassNode rhsType, Expression assignmentExpression)

boolean handleIncompatibleReturnType(ReturnStatement returnStatement, ClassNode inferredReturnType)

List handleMissingMethod(ClassNode receiver, String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)

boolean handleUnresolvedAttribute(AttributeExpression aexp)

boolean handleUnresolvedProperty(PropertyExpression pexp)

boolean handleUnresolvedVariableExpression(VariableExpression vexp)

boolean isAnnotatedBy(ASTNode node, Class annotation)

boolean isAnnotatedBy(ASTNode node, ClassNode annotation)

boolean isDynamic(VariableExpression var)

boolean isExtensionMethod(MethodNode node)

boolean isGenerated(MethodNode node)

boolean isMethodCall(Object o)

void log(String message)

MethodNode makeDynamic(MethodCall call)

MethodNode makeDynamic(MethodCall call, ClassNode returnType)

void makeDynamic(PropertyExpression pexp)

Instructs the type checker that a property access is dynamic, returning an instance of an Object.

void makeDynamic(PropertyExpression pexp, ClassNode returnType)

void makeDynamic(VariableExpression vexp)

Instructs the type checker that an unresolved variable is a dynamic variable of type Object.

void makeDynamic(VariableExpression vexp, ClassNode returnType)

MethodNode newMethod(String name, Class returnType)

MethodNode newMethod(String name, ClassNode returnType)

MethodNode newMethod(String name, Callable returnType)

GroovyTypeCheckingExtensionSupport.TypeCheckingScope newScope()

GroovyTypeCheckingExtensionSupport.TypeCheckingScope newScope(Closure code)

void onMethodSelection(Expression expression, MethodNode target)

BinaryExpression popEnclosingBinaryExpression()

ClassNode popEnclosingClassNode()

EnclosingClosure popEnclosingClosure()

MethodNode popEnclosingMethod()

Expression popEnclosingMethodCall()

void popTemporaryTypeInfo()

void pushEnclosingBinaryExpression(BinaryExpression binaryExpression)

void pushEnclosingClassNode(ClassNode classNode)

void pushEnclosingClosureExpression(ClosureExpression closureExpression)

void pushEnclosingMethod(MethodNode methodNode)

void pushEnclosingMethodCall(Expression call)

void pushTemporaryTypeInfo()

GroovyTypeCheckingExtensionSupport.TypeCheckingScope scopeExit()

GroovyTypeCheckingExtensionSupport.TypeCheckingScope scopeExit(Closure code)

void setDebug(boolean debug)

void setHandled(boolean handled)

void setup()

List unique(MethodNode node)

R withTypeChecker(Closure code)

 
Methods inherited from class TypeCheckingExtension
addStaticTypeError, 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
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

GroovyTypeCheckingExtensionSupport

public GroovyTypeCheckingExtensionSupport(StaticTypeCheckingVisitor typeCheckingVisitor, String scriptPath, CompilationUnit compilationUnit)


 
Method Detail

afterMethodCall

@Override@
public void afterMethodCall(MethodCall call)


afterVisitClass

@Override
public void afterVisitClass(ClassNode node)


afterVisitMethod

@Override
public void afterVisitMethod(MethodNode node)


argTypeMatches

public boolean argTypeMatches(ClassNode[] argTypes, int index, Class clazz)


argTypeMatches

public boolean argTypeMatches(MethodCall call, int index, Class clazz)


argTypesMatches

public boolean argTypesMatches(ClassNode[] argTypes, Class... classes)


argTypesMatches

public boolean argTypesMatches(MethodCall call, Class... classes)


beforeMethodCall

@Overridereturn handled;
public boolean beforeMethodCall(MethodCall call)


beforeVisitClass

@Overridereturn handled;
public boolean beforeVisitClass(ClassNode node)


beforeVisitMethod

@Overridereturn handled;
public boolean beforeVisitMethod(MethodNode node)


delegatesTo

public void delegatesTo(ClassNode type)


delegatesTo

public void delegatesTo(ClassNode type, int strategy)


delegatesTo

public void delegatesTo(ClassNode type, int strategy, DelegationMetadata parent)


finish

@Override
public void finish()


firstArgTypesMatches

public boolean firstArgTypesMatches(ClassNode[] argTypes, Class... classes)


firstArgTypesMatches

public boolean firstArgTypesMatches(MethodCall call, Class... classes)


getArguments

public ArgumentListExpression getArguments(MethodCall call)


getCurrentScope

public GroovyTypeCheckingExtensionSupport.TypeCheckingScope getCurrentScope()


getEnclosingBinaryExpression

public BinaryExpression getEnclosingBinaryExpression()


getEnclosingBinaryExpressionStack

public List getEnclosingBinaryExpressionStack()


getEnclosingClassNode

public ClassNode getEnclosingClassNode()


getEnclosingClassNodes

public List getEnclosingClassNodes()


getEnclosingClosure

public EnclosingClosure getEnclosingClosure()


getEnclosingClosureStack

public List getEnclosingClosureStack()


getEnclosingMethod

public MethodNode getEnclosingMethod()


getEnclosingMethodCall

public Expression getEnclosingMethodCall()


getEnclosingMethodCalls

public List getEnclosingMethodCalls()


getEnclosingMethods

public List getEnclosingMethods()


handleAmbiguousMethods

@OverrideObject result = safeCall(closure, methodList, origin);
@SuppressWarningsif (result != null) {
public List handleAmbiguousMethods(List nodes, Expression origin)


handleIncompatibleAssignment

@Overridereturn handled;
public boolean handleIncompatibleAssignment(ClassNode lhsType, ClassNode rhsType, Expression assignmentExpression)


handleIncompatibleReturnType

@Overridereturn handled;
public boolean handleIncompatibleReturnType(ReturnStatement returnStatement, ClassNode inferredReturnType)


handleMissingMethod

@Overrideif (result instanceof MethodNode) {
@SuppressWarningsmethodList.add((MethodNode) result);
public List handleMissingMethod(ClassNode receiver, String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)


handleUnresolvedAttribute

@Overridereturn handled;
public boolean handleUnresolvedAttribute(AttributeExpression aexp)


handleUnresolvedProperty

@Overridereturn handled;
public boolean handleUnresolvedProperty(PropertyExpression pexp)


handleUnresolvedVariableExpression

@Overridereturn handled;
public boolean handleUnresolvedVariableExpression(VariableExpression vexp)


isAnnotatedBy

public boolean isAnnotatedBy(ASTNode node, Class annotation)


isAnnotatedBy

public boolean isAnnotatedBy(ASTNode node, ClassNode annotation)


isDynamic

public boolean isDynamic(VariableExpression var)


isExtensionMethod

public boolean isExtensionMethod(MethodNode node)


isGenerated

public boolean isGenerated(MethodNode node)


isMethodCall

public boolean isMethodCall(Object o)


log

public void log(String message)


makeDynamic

public MethodNode makeDynamic(MethodCall call)


makeDynamic

public MethodNode makeDynamic(MethodCall call, ClassNode returnType)


makeDynamic

public 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


makeDynamic

public void makeDynamic(PropertyExpression pexp, ClassNode returnType)


makeDynamic

public 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


makeDynamic

public void makeDynamic(VariableExpression vexp, ClassNode returnType)


newMethod

public MethodNode newMethod(String name, Class returnType)


newMethod

public MethodNode newMethod(String name, ClassNode returnType)


newMethod

public MethodNode newMethod(String name, Callable returnType)


newScope

public GroovyTypeCheckingExtensionSupport.TypeCheckingScope newScope()


newScope

public GroovyTypeCheckingExtensionSupport.TypeCheckingScope newScope(Closure code)


onMethodSelection

@Override
public void onMethodSelection(Expression expression, MethodNode target)


popEnclosingBinaryExpression

public BinaryExpression popEnclosingBinaryExpression()


popEnclosingClassNode

public ClassNode popEnclosingClassNode()


popEnclosingClosure

public EnclosingClosure popEnclosingClosure()


popEnclosingMethod

public MethodNode popEnclosingMethod()


popEnclosingMethodCall

public Expression popEnclosingMethodCall()


popTemporaryTypeInfo

public void popTemporaryTypeInfo()


pushEnclosingBinaryExpression

public void pushEnclosingBinaryExpression(BinaryExpression binaryExpression)


pushEnclosingClassNode

public void pushEnclosingClassNode(ClassNode classNode)


pushEnclosingClosureExpression

public void pushEnclosingClosureExpression(ClosureExpression closureExpression)


pushEnclosingMethod

public void pushEnclosingMethod(MethodNode methodNode)


pushEnclosingMethodCall

public void pushEnclosingMethodCall(Expression call)


pushTemporaryTypeInfo

public void pushTemporaryTypeInfo()


scopeExit

public GroovyTypeCheckingExtensionSupport.TypeCheckingScope scopeExit()


scopeExit

public GroovyTypeCheckingExtensionSupport.TypeCheckingScope scopeExit(Closure code)


setDebug

public void setDebug(boolean debug)


setHandled

public void setHandled(boolean handled)


setup

@Overrideconfig.setScriptBaseClass("org.codehaus.groovy.transform.stc.GroovyTypeCheckingExtensionSupport.TypeCheckingDSL");
public void setup()


unique

public List unique(MethodNode node)


withTypeChecker

@SuppressWarnings* Used to instruct the type checker that the call is a dynamic method call.
public R withTypeChecker(Closure code)


 

Copyright © 2003-2013 The Codehaus. All rights reserved.