[
https://issues.apache.org/jira/browse/GROOVY-9914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-9914.
---------------------------------
Fix Version/s: 4.0.0-alpha-3
Resolution: Fixed
> map.collectEntries extension method variant returns Map<?,?>
> ------------------------------------------------------------
>
> Key: GROOVY-9914
> URL: https://issues.apache.org/jira/browse/GROOVY-9914
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 4.0.0-alpha-3
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test(Map<String,String> one) {
> Map<String,Integer> two = one.collectEntries { k,v ->
> [k: v.hashCode()]
> }
> }
> {code}
> Assignment to "two" produces the following error "[Static type checking] -
> Incompatible generic argument types. Cannot assign java.util.Map <?, ?> to:
> java.util.Map <String, Integer>".
> The "collectEntries" variant called here returns "Map<?,?>"; all other
> variants return a parameterized type that is determined by the caller.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)