Package: org.codehaus.groovy.transform.stc

## [Java] Class GroovyTypeCheckingExtensionSupport

- org.codehaus.groovy.transform.stc.GroovyTypeCheckingExtensionSupport

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

  Since:
    2.1.0

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `GroovyTypeCheckingExtensionSupport.TypeCheckingDSL` | Event handler registration: setup Registers closure that runs after the type checker finishes initialization finish Registers closure that runs after the type checker completes type checking beforeVisitClass Registers closure that runs before type checking a class afterVisitClass Registers closure that runs after having finished the visit of a type checked class beforeVisitMethod Registers closure that runs before type checking a method body afterVisitMethod Registers closure that runs after type checking a method body beforeMethodCall Registers closure that runs before the type checker starts type checking a method call afterMethodCall Registers closure that runs once the type checker has finished type checking a method call methodNotFound Registers closure that runs when it fails to find an appropriate method for a method call ambiguousMethods Registers closure that runs when the type checker cannot choose between several candidate methods onMethodSelection Registers closure that runs when it finds a method appropriate for a method call unresolvedVariable Registers closure that runs when the type checker finds an unresolved variable unresolvedProperty Registers closure that runs when the type checker cannot find a property on the receiver unresolvedAttribute Registers closure that runs when the type checker cannot find an attribute on the receiver incompatibleAssignment Registers closure that runs when the type checker thinks that the right-hand side of an assignment is incompatible with the left-hand side incompatibleReturnType Registers closure that runs when the type checker thinks that a return value is incompatibe with the return type

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class AbstractTypeCheckingExtension` | `context, debug, handled`
    `class TypeCheckingExtension` | `typeCheckingVisitor`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GroovyTypeCheckingExtensionSupport (StaticTypeCheckingVisitor typeCheckingVisitor, String scriptPath, CompilationUnit compilationUnit)` Builds a type checking extension relying on a Groovy script (type checking DSL).

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `afterMethodCall(MethodCall call)`
    `` | `void` | `afterVisitClass(ClassNode node)`
    `` | `void` | `afterVisitMethod(MethodNode node)`
    `` | `boolean` | `beforeMethodCall(MethodCall call)`
    `` | `boolean` | `beforeVisitClass(ClassNode node)`
    `` | `boolean` | `beforeVisitMethod(MethodNode node)`
    `` | `void` | `finish()`
    `` | `List<MethodNode>` | `handleAmbiguousMethods(List<MethodNode> nodes, Expression origin)`
    `` | `boolean` | `handleIncompatibleAssignment(ClassNode lhsType, ClassNode rhsType, Expression assignmentExpression)`
    `` | `boolean` | `handleIncompatibleReturnType(ReturnStatement returnStatement, ClassNode inferredReturnType)`
    `` | `List<MethodNode>` | `handleMissingMethod(ClassNode receiver, String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)`
    `` | `boolean` | `handleUnresolvedAttribute(AttributeExpression aexp)`
    `` | `boolean` | `handleUnresolvedProperty(PropertyExpression pexp)`
    `` | `boolean` | `handleUnresolvedVariableExpression(VariableExpression vexp)`
    `` | `void` | `onMethodSelection(Expression expression, MethodNode target)`
    `` | `void` | `setDebug(boolean debug)`
    `` | `void` | `setup()`

  - ### Inherited Methods Summary

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

- - ### Constructor Detail

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

      Builds a type checking extension relying on a Groovy script (type checking DSL).

      Parameters:
        `typeCheckingVisitor` - the type checking visitor
        `scriptPath` - the path to the type checking script (in classpath)
        compilationUnit

  - ### Method Detail

    - #### @Override public void afterMethodCall(MethodCall call)

    - #### @Override public void afterVisitClass(ClassNode node)

    - #### @Override public void afterVisitMethod(MethodNode node)

    - #### @Override public boolean beforeMethodCall(MethodCall call)

    - #### @Override public boolean beforeVisitClass(ClassNode node)

    - #### @Override public boolean beforeVisitMethod(MethodNode node)

    - #### @Override public void finish()

    - #### @Override @SuppressWarnings("unchecked") public List<MethodNode> handleAmbiguousMethods(List<MethodNode> nodes, Expression origin)

    - #### @Override public boolean handleIncompatibleAssignment(ClassNode lhsType, ClassNode rhsType, Expression assignmentExpression)

    - #### @Override public boolean handleIncompatibleReturnType(ReturnStatement returnStatement, ClassNode inferredReturnType)

    - #### @Override @SuppressWarnings("unchecked") public List<MethodNode> handleMissingMethod(ClassNode receiver, String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)

    - #### @Override public boolean handleUnresolvedAttribute(AttributeExpression aexp)

    - #### @Override public boolean handleUnresolvedProperty(PropertyExpression pexp)

    - #### @Override public boolean handleUnresolvedVariableExpression(VariableExpression vexp)

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

    - #### public void setDebug(boolean debug)

    - #### @Override public void setup()