Eric Milles created GROOVY-10328:
------------------------------------
Summary: 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
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)