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

iterating Tuple2s loses type parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 4.0.13
    • None
    • Static Type Checker
    • None

    Description

      With static compilation, when iterating a collection of Tuple2s, the Tuple2's type parameters are lost.

      This example fails to compile:

      import groovy.transform.CompileStatic
      
      @CompileStatic  // compiles successfully without this
      class Tuple2Parameters {
          List<Tuple2<String, String>> myList = []
      
          void myMethod() {
             myList.each { String first, String second ->  // [Static type checking] - Expected type java.lang.Object for closure parameters
                true
             }
          }
      } 

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              jasongarrett Jason Garrett
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: