AbstractTypeCheckingExtension (Groovy 5.1.0)

Package: org.codehaus.groovy.transform.stc

## [Java] Class AbstractTypeCheckingExtension

- org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension

-     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
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `AbstractTypeCheckingExtension.TypeCheckingScope` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected TypeCheckingContext` | `context` |
    `protected boolean` | `debug` | See Also: log(String)
    `protected boolean` | `handled` | See Also: setHandled(boolean)

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class TypeCheckingExtension` | `typeCheckingVisitor`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `AbstractTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `argTypeMatches(ClassNode[] argTypes, int index, Class clazz)`
    `` | `public boolean` | `argTypeMatches(MethodCall call, int index, Class clazz)`
    `` | `public boolean` | `argTypesMatches(ClassNode[] argTypes, Class classes)`
    `` | `public boolean` | `argTypesMatches(MethodCall call, Class classes)`
    `` | `public void` | `delegatesTo(ClassNode type)`
    `` | `public void` | `delegatesTo(ClassNode type, int strategy)`
    `` | `public void` | `delegatesTo(ClassNode type, int strategy, DelegationMetadata parent)`
    `` | `public boolean` | `firstArgTypesMatches(ClassNode[] argTypes, Class classes)`
    `` | `public boolean` | `firstArgTypesMatches(MethodCall call, Class classes)`
    `` | `public ArgumentListExpression` | `getArguments(MethodCall call)`
    `` | `public AbstractTypeCheckingExtension.TypeCheckingScope` | `getCurrentScope()`
    `` | `public BinaryExpression` | `getEnclosingBinaryExpression()`
    `` | `public List<BinaryExpression>` | `getEnclosingBinaryExpressionStack()`
    `` | `public ClassNode` | `getEnclosingClassNode()`
    `` | `public List<ClassNode>` | `getEnclosingClassNodes()`
    `` | `public EnclosingClosure` | `getEnclosingClosure()`
    `` | `public List<TypeCheckingContext.EnclosingClosure>` | `getEnclosingClosureStack()`
    `` | `public MethodNode` | `getEnclosingMethod()`
    `` | `public Expression` | `getEnclosingMethodCall()`
    `` | `public List<Expression>` | `getEnclosingMethodCalls()`
    `` | `public List<MethodNode>` | `getEnclosingMethods()`
    `` | `public Set<MethodNode>` | `getGeneratedMethods()`
    `` | `public ClassNode` | `getReturnType()`
    `` | `public boolean` | `isAnnotatedBy(ASTNode node, Class annotation)`
    `` | `public boolean` | `isAnnotatedBy(ASTNode node, ClassNode annotation)`
    `` | `public boolean` | `isDynamic(VariableExpression var)`
    `` | `public boolean` | `isExtensionMethod(MethodNode node)`
    `` | `public boolean` | `isGenerated(MethodNode node)`
    `` | `public boolean` | `isMethodCall(Object o)`
    `` | `public void` | `log(String message)`
    `` | `public MethodNode` | `makeDynamic(MethodCall call)` Used to instruct the type checker that the call is a dynamic method call.
    `` | `public MethodNode` | `makeDynamic(MethodCall call, ClassNode returnType)` Used to instruct the type checker that the call is a dynamic method call.
    `` | `public void` | `makeDynamic(PropertyExpression pexp)` Instructs the type checker that a property access is dynamic, returning an instance of an Object.
    `` | `public void` | `makeDynamic(PropertyExpression pexp, ClassNode returnType)` Instructs the type checker that a property access is dynamic.
    `` | `public void` | `makeDynamic(VariableExpression vexp)` Instructs the type checker that an unresolved variable is a dynamic variable of type Object.
    `` | `public void` | `makeDynamic(VariableExpression vexp, ClassNode returnType)` Instructs the type checker that an unresolved variable is a dynamic variable.
    `` | `public MethodNode` | `newMethod(String name, Class returnType)`
    `` | `public MethodNode` | `newMethod(String name, ClassNode returnType)`
    `` | `public MethodNode` | `newMethod(String name, Callable<ClassNode> returnType)`
    `` | `public AbstractTypeCheckingExtension.TypeCheckingScope` | `newScope()`
    `` | `public AbstractTypeCheckingExtension.TypeCheckingScope` | `newScope(Closure code)`
    `` | `public BinaryExpression` | `popEnclosingBinaryExpression()`
    `` | `public ClassNode` | `popEnclosingClassNode()`
    `` | `public EnclosingClosure` | `popEnclosingClosure()`
    `` | `public MethodNode` | `popEnclosingMethod()`
    `` | `public Expression` | `popEnclosingMethodCall()`
    `` | `public void` | `popTemporaryTypeInfo()`
    `` | `public void` | `pushEnclosingBinaryExpression(BinaryExpression binaryExpression)`
    `` | `public void` | `pushEnclosingClassNode(ClassNode classNode)`
    `` | `public void` | `pushEnclosingClosureExpression(ClosureExpression closureExpression)`
    `` | `public void` | `pushEnclosingMethod(MethodNode methodNode)`
    `` | `public void` | `pushEnclosingMethodCall(Expression call)`
    `` | `public void` | `pushTemporaryTypeInfo()`
    `` | `protected Object` | `safeCall(Closure closure, Object args)`
    `` | `public AbstractTypeCheckingExtension.TypeCheckingScope` | `scopeExit()`
    `` | `public AbstractTypeCheckingExtension.TypeCheckingScope` | `scopeExit(Closure code)`
    `` | `public void` | `setHandled(boolean handled)`
    `` | `public List<MethodNode>` | `unique(MethodNode node)`
    `<R>` | `public R` | `withTypeChecker(Closure<R> code)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `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`

- - ### Field Detail

    - #### protected final TypeCheckingContext context

    - #### protected boolean debug

      See Also:
        log(String)

    - #### protected boolean handled

      See Also:
        setHandled(boolean)

  - ### Constructor Detail

    - #### public AbstractTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)

  - ### Method Detail

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

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

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

    - #### public boolean argTypesMatches(MethodCall call, Class classes)

    - #### public void delegatesTo(ClassNode type)

    - #### public void delegatesTo(ClassNode type, int strategy)

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

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

    - #### public boolean firstArgTypesMatches(MethodCall call, Class classes)

    - #### public ArgumentListExpression getArguments(MethodCall call)

    - #### public AbstractTypeCheckingExtension.TypeCheckingScope getCurrentScope()

    - #### public BinaryExpression getEnclosingBinaryExpression()

    - #### public List<BinaryExpression> getEnclosingBinaryExpressionStack()

    - #### public ClassNode getEnclosingClassNode()

    - #### public List<ClassNode> getEnclosingClassNodes()

    - #### public EnclosingClosure getEnclosingClosure()

    - #### public List<TypeCheckingContext.EnclosingClosure> getEnclosingClosureStack()

    - #### public MethodNode getEnclosingMethod()

    - #### public Expression getEnclosingMethodCall()

    - #### public List<Expression> getEnclosingMethodCalls()

    - #### public List<MethodNode> getEnclosingMethods()

    - #### public Set<MethodNode> getGeneratedMethods()

    - #### @Override
      public ClassNode getReturnType()

    - #### public boolean isAnnotatedBy(ASTNode node, Class annotation)

    - #### public boolean isAnnotatedBy(ASTNode node, ClassNode annotation)

    - #### public boolean isDynamic(VariableExpression var)

    - #### public boolean isExtensionMethod(MethodNode node)

    - #### public boolean isGenerated(MethodNode node)

    - #### public boolean isMethodCall(Object o)

    - #### public void log(String message)

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

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

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

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

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

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

    - #### public MethodNode newMethod(String name, Class returnType)

    - #### public MethodNode newMethod(String name, ClassNode returnType)

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

    - #### public AbstractTypeCheckingExtension.TypeCheckingScope newScope()

    - #### public AbstractTypeCheckingExtension.TypeCheckingScope newScope(Closure code)

    - #### public BinaryExpression popEnclosingBinaryExpression()

    - #### public ClassNode popEnclosingClassNode()

    - #### public EnclosingClosure popEnclosingClosure()

    - #### public MethodNode popEnclosingMethod()

    - #### public Expression popEnclosingMethodCall()

    - #### public void popTemporaryTypeInfo()

    - #### public void pushEnclosingBinaryExpression(BinaryExpression binaryExpression)

    - #### public void pushEnclosingClassNode(ClassNode classNode)

    - #### public void pushEnclosingClosureExpression(ClosureExpression closureExpression)

    - #### public void pushEnclosingMethod(MethodNode methodNode)

    - #### public void pushEnclosingMethodCall(Expression call)

    - #### public void pushTemporaryTypeInfo()

    - #### protected Object safeCall(Closure closure, Object args)

    - #### public AbstractTypeCheckingExtension.TypeCheckingScope scopeExit()

    - #### public AbstractTypeCheckingExtension.TypeCheckingScope scopeExit(Closure code)

    - #### public void setHandled(boolean handled)

    - #### public List<MethodNode> unique(MethodNode node)

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