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

STC: error for closure not matching functional interface method's parameter count

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.8, 4.0.0-alpha-3
    • None
    • None

    Description

      Consider the following:

      import java.util.function.*
      @groovy.transform.TypeChecked
      void test() {
        Consumer c0 = { print it } // error
        Consumer c1 = { x -> } // all good
        Supplier s0 = { -> "" } // all good
        Supplier s1 = { "" } // all good
      }
      

      The implicit parameter closure literal (no arrow) should match for 0 or 1 parameter method targets.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h