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

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0-beta-1
    • Component/s: Static Type Checker
    • Labels:
      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

          There are no Sub-Tasks for this issue.

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: