Class PickFirstResolver

java.lang.Object
groovy.transform.stc.ClosureSignatureConflictResolver
groovy.transform.stc.PickFirstResolver

public class PickFirstResolver
extends ClosureSignatureConflictResolver
Returns the first of several candidates found. This is useful if several types should be supported but only the first should be the default/inferred type. Other options in the list are obtained through explicitly typing the parameter(s).
Since:
2.5.0
  • Constructor Summary

    Constructors
    Constructor Description
    PickFirstResolver()  
  • Method Summary

    Modifier and Type Method Description
    java.util.List<ClassNode[]> resolve​(java.util.List<ClassNode[]> candidates, ClassNode receiver, Expression arguments, ClosureExpression closure, MethodNode methodNode, SourceUnit sourceUnit, CompilationUnit compilationUnit, java.lang.String[] options)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PickFirstResolver

      public PickFirstResolver()
  • Method Details

    • resolve

      public java.util.List<ClassNode[]> resolve​(java.util.List<ClassNode[]> candidates, ClassNode receiver, Expression arguments, ClosureExpression closure, MethodNode methodNode, SourceUnit sourceUnit, CompilationUnit compilationUnit, java.lang.String[] options)
      Overrides:
      resolve in class ClosureSignatureConflictResolver
      Parameters:
      candidates - the list of signatures as determined after applying type hints and performing initial inference calculations
      receiver - the receiver the method is being called on
      arguments - the arguments for the closure
      closure - the closure expression under analysis
      methodNode - the method for which a Closure parameter was annotated with ClosureParams
      sourceUnit - the source unit of the file being compiled
      compilationUnit - the compilation unit of the file being compiled
      options - the options, corresponding to the ClosureParams.options() found on the annotation
      Returns:
      a non-null list of signatures, where a signature corresponds to an array of class nodes, each of them matching a parameter. A list with more than one element indicates that all ambiguities haven't yet been resolved.