Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9813

Support matching functional interface to variadic method reference

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.4
    • None

    Description

      Java supports each of the following functional interface assignments for a variadic method like java.util.Arrays#asList.

      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
      }
      

      Note: Groovy compiler only produces error for first incompatible method reference.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: