[
https://issues.apache.org/jira/browse/GROOVY-10328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17433388#comment-17433388
]
Eric Milles commented on GROOVY-10328:
--------------------------------------
https://github.com/apache/groovy/commit/51eb2a026a9ce1b4f6232d8ac4414eda586ac3e0
> STC: incorrect type inference for list, map, etc. with lower bound generics
> ---------------------------------------------------------------------------
>
> Key: GROOVY-10328
> URL: https://issues.apache.org/jira/browse/GROOVY-10328
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-beta-2
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test(List<? super String> list, Map<String, ? super String> map) {
> def a = list.first()
> def b = list.get(0)
> def c = list[0]
> def x = map.get('foo')
> def y = map['foo']
> def z = map.foo
> }
> {code}
> The type inferred for each of the local variables is String, which is an
> unsafe assumption. Java infers Object for the same case (when "var" is used).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)