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

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.8, 4.0.0-alpha-3
    • Component/s: None
    • Labels:
      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

            • Assignee:
              emilles Eric Milles
              Reporter:
              emilles Eric Milles

              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

                  Issue deployment