Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0.20, 4.0.17
-
None
Description
There's a chance this is a duplicate of a ticket recently fixed, but it's odd enough (and the message is unclear enough) that I'm reposting it.
Map<String, List<String>> idsForAccounts(Collection<String> persons) { Map<Object, Object> fromGraph = retrieve() // workaround for buggy database implementation follows new HashMap<String, List<String>>().tap { result -> putAll(fromGraph as Map<String, List<String>>) persons.forEach { if (!result.containsKey(it)) { result.put(it, emptyList()) } } } }
[Static type checking] - Cannot find matching method java.util.HashMap#put(java.lang.String, java.util.List<#T>). Please check if the declared type is correct and if the method exists. @ line 73, column 21. result.put(it, emptyList()) ^
Update: Using a type witness as Collections.<String> emptyList() works.
Attachments
Issue Links
- is related to
-
GROOVY-11057 STC Generic type matching failure
- Closed