You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jason Garrett (Jira)" <ji...@apache.org> on 2023/07/13 13:11:00 UTC

[jira] [Created] (GROOVY-11124) iterating Tuple2s loses type parameters

Jason Garrett created GROOVY-11124:
--------------------------------------

             Summary: iterating Tuple2s loses type parameters
                 Key: GROOVY-11124
                 URL: https://issues.apache.org/jira/browse/GROOVY-11124
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 4.0.13
            Reporter: Jason Garrett


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

This example fails to compile:
{code:java}
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
       }
    }
} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)