Package groovy.transform.stc
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 List<ClassNode[]>
resolve(List<ClassNode[]> candidates, ClassNode receiver, Expression arguments, ClosureExpression closure, MethodNode methodNode, SourceUnit sourceUnit, CompilationUnit compilationUnit, String[] options)
-
Constructor Details
-
PickFirstResolver
public PickFirstResolver()
-
-
Method Details
-
resolve
public List<ClassNode[]> resolve(List<ClassNode[]> candidates, ClassNode receiver, Expression arguments, ClosureExpression closure, MethodNode methodNode, SourceUnit sourceUnit, CompilationUnit compilationUnit, String[] options)- Overrides:
resolve
in classClosureSignatureConflictResolver
- Parameters:
candidates
- the list of signatures as determined after applying type hints and performing initial inference calculationsreceiver
- the receiver the method is being called onarguments
- the arguments for the closureclosure
- the closure expression under analysismethodNode
- the method for which aClosure
parameter was annotated withClosureParams
sourceUnit
- the source unit of the file being compiledcompilationUnit
- the compilation unit of the file being compiledoptions
- the options, corresponding to theClosureParams.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.
-