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:28:00 UTC
[jira] [Commented] (GROOVY-11125) withIndex().collect loses type parameters
[ https://issues.apache.org/jira/browse/GROOVY-11125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17742867#comment-17742867 ]
Eric Milles commented on GROOVY-11125:
--------------------------------------
This is fixed by GROOVY-11090.
> withIndex().collect loses type parameters
> -----------------------------------------
>
> Key: GROOVY-11125
> URL: https://issues.apache.org/jira/browse/GROOVY-11125
> 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, the types of the parameters to withIndex().collect{} are lost.
> This example fails to compile:
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic // compiles without this
> class WithIndexCollectParameters {
> List<String> myList = []
> void myMethod() {
> myList.withIndex().collect { String str, int idx -> // [Static type checking] - Expected type java.lang.Object for closure parameters
> true
> }
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)