Package org.codehaus.groovy.transform.stc

# Class TraitTypeCheckingExtension

java.lang.Object
org.codehaus.groovy.transform.stc.TypeCheckingExtension
org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension
org.codehaus.groovy.transform.stc.TraitTypeCheckingExtension

public class TraitTypeCheckingExtension extends AbstractTypeCheckingExtension
An extension that handles field, super and static method calls within a trait.

Since:
  2.3.0

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.codehaus.groovy.transform.stc.AbstractTypeCheckingExtension

  `AbstractTypeCheckingExtension.TypeCheckingScope`

- ## Field Summary

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

  `context, debug, handled`

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

  `typeCheckingVisitor`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TraitTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)`
  Creates the trait-specific type-checking extension.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<MethodNode>`
  `handleMissingMethod(ClassNode receiver, String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)`
  Resolves trait super calls and helper-backed trait method dispatch.
  `boolean`
  `handleUnresolvedProperty(PropertyExpression pexp)`
  Resolves synthetic trait static-field accessor properties.

  ### Methods inherited from class org.codehaus.groovy.transform.stc.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`

  ### 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, handleUnresolvedAttribute, 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`

- ## Constructor Details

  - ### TraitTypeCheckingExtension

    public TraitTypeCheckingExtension(StaticTypeCheckingVisitor typeCheckingVisitor)
    Creates the trait-specific type-checking extension.

- ## Method Details

  - ### handleMissingMethod

    public List<MethodNode> handleMissingMethod(ClassNode receiver, String name, ArgumentListExpression argumentList, ClassNode[] argumentTypes, MethodCall call)
    Resolves trait super calls and helper-backed trait method dispatch.
    Overrides:
      `handleMissingMethod` in class `TypeCheckingExtension`
    Parameters:
      `receiver` - the type of the receiver
      `name` - the name of the called method
      `argumentList` - the list of arguments of the call
      `argumentTypes` - the types of the arguments of the call
      `call` - the method call itself, if needed
    Returns:
      an empty list if the extension cannot resolve the method, or a list of potential methods if the extension finds candidates. This method must not return null.

  - ### handleUnresolvedProperty

    public boolean handleUnresolvedProperty(PropertyExpression pexp)
    Resolves synthetic trait static-field accessor properties.
    Overrides:
      `handleUnresolvedProperty` in class `TypeCheckingExtension`
    Parameters:
      `pexp` - the unresolved property
    Returns:
      `boolean` false if this extension doesn't resolve the property, true if it resolves the property.