[ https://issues.apache.org/jira/browse/GROOVY-10712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10712: --------------------------------- Fix Version/s: (was: 2.5.19) (was: 3.0.13) > STC: for-each over Iterator fails to infer element type > ------------------------------------------------------- > > Key: GROOVY-10712 > URL: https://issues.apache.org/jira/browse/GROOVY-10712 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Affects Versions: 4.0.4 > Reporter: Eric Milles > Assignee: Eric Milles > Priority: Minor > Fix For: 4.0.5 > > > Consider the following: > {code:groovy} > @groovy.transform.TypeChecked > void test() { > def list = ['a','b'] > for (item in list.iterator()) { > item.toUpperCase() // Cannot find matching method Object#toUpperCase() > } > } > {code} > Inferred type of "item" is {{java.lang.Object}}. Without ".iterator()" it is > {{java.lang.String}}. -- This message was sent by Atlassian Jira (v8.20.10#820010)