Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Consider the following:
@groovy.transform.TypeChecked void test(Map<String,String> one) { Map<String,Integer> two = one.collectEntries { k,v -> [k: v.hashCode()] } }
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.