Package org.codehaus.groovy.transform.stc

# 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 `GroovyTypeCheckingExtensionSupport` class.

Since:
  2.3.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `AbstractTypeCheckingExtension.TypeCheckingScope`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final TypeCheckingContext`
  `context`
  `protected boolean`
  `debug`
  `protected boolean`
  `handled`

  ### Fields inherited from class org.codehaus.groovy.transform.stc.TypeCheckingExtension

  `typeCheckingVisitor`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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)`
  `void`
  `delegatesTo(ClassNode type)`
  `void`
  `delegatesTo(ClassNode type, int strategy)`
  `void`
  `delegatesTo(ClassNode type, int strategy, org.codehaus.groovy.transform.stc.DelegationMetadata parent)`
  `boolean`
  `firstArgTypesMatches(ClassNode[] argTypes, Class... classes)`
  `boolean`
  `firstArgTypesMatches(MethodCall call, Class... classes)`
  `ArgumentListExpression`
  `getArguments(MethodCall call)`
  `AbstractTypeCheckingExtension.TypeCheckingScope`
  `getCurrentScope()`
  `BinaryExpression`
  `getEnclosingBinaryExpression()`
  `List<BinaryExpression>`
  `getEnclosingBinaryExpressionStack()`
  `ClassNode`
  `getEnclosingClassNode()`
  `List<ClassNode>`
  `getEnclosingClassNodes()`
  `TypeCheckingContext.EnclosingClosure`
  `getEnclosingClosure()`
  `List<TypeCheckingContext.EnclosingClosure>`
  `getEnclosingClosureStack()`
  `MethodNode`
  `getEnclosingMethod()`
  `Expression`
  `getEnclosingMethodCall()`
  `List<Expression>`
  `getEnclosingMethodCalls()`
  `List<MethodNode>`
  `getEnclosingMethods()`
  `Set<MethodNode>`
  `getGeneratedMethods()`
  `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)`
  Used to instruct the type checker that the call is a dynamic method call.
  `MethodNode`
  `makeDynamic(MethodCall call, ClassNode returnType)`
  Used to instruct the type checker that the call is a dynamic method call.
  `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)`
  Instructs the type checker that a property access is dynamic.
  `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)`
  Instructs the type checker that an unresolved variable is a dynamic variable.
  `MethodNode`
  `newMethod(String name, Class returnType)`
  `MethodNode`
  `newMethod(String name, Callable<ClassNode> returnType)`
  `MethodNode`
  `newMethod(String name, ClassNode returnType)`
  `AbstractTypeCheckingExtension.TypeCheckingScope`
  `newScope()`
  `AbstractTypeCheckingExtension.TypeCheckingScope`
  `newScope(Closure code)`
  `BinaryExpression`
  `popEnclosingBinaryExpression()`
  `ClassNode`
  `popEnclosingClassNode()`
  `TypeCheckingContext.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()`
  `protected Object`
  `safeCall(Closure closure, Object... args)`
  `AbstractTypeCheckingExtension.TypeCheckingScope`
  `scopeExit()`
  `AbstractTypeCheckingExtension.TypeCheckingScope`
  `scopeExit(Closure code)`
  `void`
  `setHandled(boolean handled)`
  `List<MethodNode>`
  `unique(MethodNode node)`
  `<R> R`
  `withTypeChecker(Closure<R> code)`

  ### 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, getOptions, getTargetMethod, getType, handleAmbiguousMethods, handleIncompatibleAssignment, handleIncompatibleReturnType, handleMissingMethod, handleUnresolvedAttribute, handleUnresolvedProperty, handleUnresolvedVariableExpression, isStaticMethodCallOnClass, lookupClassNodeFor, onMethodSelection, parameterizedType, setOptions, setup, storeType`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### context

    protected final TypeCheckingContext context

  - ### debug

    protected boolean debug

  - ### handled

    protected boolean handled

- ## Constructor Details

  - ### AbstractTypeCheckingExtension

    public AbstractTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)

- ## Method Details

  - ### setHandled

    public void setHandled(boolean handled)

  - ### newScope

    public AbstractTypeCheckingExtension.TypeCheckingScope newScope()

  - ### newScope

    public AbstractTypeCheckingExtension.TypeCheckingScope newScope(Closure code)

  - ### scopeExit

    public AbstractTypeCheckingExtension.TypeCheckingScope scopeExit()

  - ### getCurrentScope

    public AbstractTypeCheckingExtension.TypeCheckingScope getCurrentScope()

  - ### scopeExit

    public AbstractTypeCheckingExtension.TypeCheckingScope scopeExit(Closure code)

  - ### isGenerated

    public boolean isGenerated(MethodNode node)

  - ### unique

    public List<MethodNode> unique(MethodNode node)

  - ### newMethod

    public MethodNode newMethod(String name, Class returnType)

  - ### newMethod

    public MethodNode newMethod(String name, ClassNode returnType)

  - ### newMethod

    public MethodNode newMethod(String name, Callable<ClassNode> returnType)

  - ### delegatesTo

    public void delegatesTo(ClassNode type)

  - ### delegatesTo

    public void delegatesTo(ClassNode type, int strategy)

  - ### delegatesTo

    public void delegatesTo(ClassNode type, int strategy, org.codehaus.groovy.transform.stc.DelegationMetadata parent)

  - ### 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)

  - ### getArguments

    public ArgumentListExpression getArguments(MethodCall call)

  - ### safeCall

    protected Object safeCall(Closure closure, Object... args)

  - ### isMethodCall

    public boolean isMethodCall(Object o)

  - ### argTypesMatches

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

  - ### argTypesMatches

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

  - ### firstArgTypesMatches

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

  - ### firstArgTypesMatches

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

  - ### argTypeMatches

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

  - ### argTypeMatches

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

  - ### withTypeChecker

    public <R> R withTypeChecker(@DelegatesTo(value=StaticTypeCheckingVisitor.class,strategy=1) @ClosureParams(value=SimpleType.class,options="org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor") Closure<R> code)

  - ### makeDynamic

    public 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

  - ### makeDynamic

    public 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

  - ### 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)
    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

  - ### 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)
    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

  - ### log

    public void log(String message)

  - ### getEnclosingBinaryExpression

    public BinaryExpression getEnclosingBinaryExpression()

  - ### pushEnclosingBinaryExpression

    public void pushEnclosingBinaryExpression(BinaryExpression binaryExpression)

  - ### pushEnclosingClosureExpression

    public void pushEnclosingClosureExpression(ClosureExpression closureExpression)

  - ### getEnclosingMethodCall

    public Expression getEnclosingMethodCall()

  - ### popEnclosingMethodCall

    public Expression popEnclosingMethodCall()

  - ### popEnclosingMethod

    public MethodNode popEnclosingMethod()

  - ### getEnclosingClassNode

    public ClassNode getEnclosingClassNode()

  - ### getEnclosingMethods

    public List<MethodNode> getEnclosingMethods()

  - ### getEnclosingMethod

    public MethodNode getEnclosingMethod()

  - ### popTemporaryTypeInfo

    public void popTemporaryTypeInfo()

  - ### pushEnclosingClassNode

    public void pushEnclosingClassNode(ClassNode classNode)

  - ### popEnclosingBinaryExpression

    public BinaryExpression popEnclosingBinaryExpression()

  - ### getEnclosingClassNodes

    public List<ClassNode> getEnclosingClassNodes()

  - ### getEnclosingClosureStack

    public List<TypeCheckingContext.EnclosingClosure> getEnclosingClosureStack()

  - ### popEnclosingClassNode

    public ClassNode popEnclosingClassNode()

  - ### pushEnclosingMethod

    public void pushEnclosingMethod(MethodNode methodNode)

  - ### getGeneratedMethods

    public Set<MethodNode> getGeneratedMethods()

  - ### getEnclosingBinaryExpressionStack

    public List<BinaryExpression> getEnclosingBinaryExpressionStack()

  - ### getEnclosingClosure

    public TypeCheckingContext.EnclosingClosure getEnclosingClosure()

  - ### getEnclosingMethodCalls

    public List<Expression> getEnclosingMethodCalls()

  - ### pushEnclosingMethodCall

    public void pushEnclosingMethodCall(Expression call)

  - ### popEnclosingClosure

    public TypeCheckingContext.EnclosingClosure popEnclosingClosure()

  - ### pushTemporaryTypeInfo

    public void pushTemporaryTypeInfo()