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

Provide a mechanism to allow the type checker to know what are the expected argument types of a closure

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

Details

    • Improvement
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 2.3.0-beta-1
    • Static Type Checker
    • None

    Description

      For methods like each, collect, times, ... that take a closure as an argument, the type checker doesn't have enough type information to infer what is the expected argument types of the closure. For example, in the following case:

      List<String> strings = ['abc','def']
      strings.collect { it.toUpperCase() }
      

      there's not enough type information in the signature of collect for the type checker to know that the type of it is a String.

      With the upcoming lambda support in JDK8, it becomes critical for us to provide such information.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            melix Cédric Champeau
            melix Cédric Champeau
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment