Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.0
-
Fix Version/s: 2.0.1
-
Component/s: Static Type Checker
-
Labels:None
-
Number of attachments :
Description
If you have a map:
Map<Date,Integer>
and that you use the entrySet() method, the inferred type is:
Set<Map.Entry<K,V>>
but it should be:
Set<Map.Entry<Date,Integer>>
(multiple levels of generics)
Here's the test case:
Map<Date, Integer> map @ASTTest(phase=INSTRUCTION_SELECTION, value={ def infType = node.getNodeMetaData(INFERRED_TYPE) assert infType == make(Set) def entryInfType = infType.genericsTypes[0].type assert entryInfType == make(Map.Entry) assert entryInfType.genericsTypes[0].type == make(Date) assert entryInfType.genericsTypes[1].type == Integer_TYPE }) def entries = map?.entrySet()
Issue Links
- is depended upon by
-
GROOVY-5587
Map.Entry<K,V>#key and #value fail to infer type correctly under @StaticCompile
-