You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/07/23 16:21:00 UTC

[jira] [Updated] (GROOVY-9813) Support matching functional interface to variadic method reference

     [ https://issues.apache.org/jira/browse/GROOVY-9813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-9813:
--------------------------------
    Fix Version/s:     (was: 5.0.0-alpha-1)

> Support matching functional interface to variadic method reference
> ------------------------------------------------------------------
>
>                 Key: GROOVY-9813
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9813
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: varargs
>             Fix For: 4.0.4
>
>
> Java supports each of the following functional interface assignments for a variadic method like {{java.util.Arrays#asList}}.
> {code:groovy}
> import java.util.function.*
> @groovy.transform.CompileStatic
> void test() {
>     Supplier<List> zero = Arrays::asList
>     Function<Integer, List> one = Arrays::asList
>     BiFunction<Integer, Integer, List> two = Arrays::asList
> }
> {code}
> Note: Groovy compiler only produces error for first incompatible method reference.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)