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

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

     [ https://issues.apache.org/jira/browse/GROOVY-11124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles closed GROOVY-11124.
--------------------------------
    Resolution: Duplicate

> 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
>            Assignee: Eric Milles
>            Priority: Minor
>
> 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)