Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.12
-
None
Description
In 4.0.12, generic types of inline map definitions are no longer correctly inferred in situations where they would be under 4.0.11. For instance, the following:
@CompileStatic class TypeCheckingTest { static final Map<String, Map<String, String>> testMap = [:] static test() { testMap.put("test", [:]) } }
Fails to compile in 4.0.12, but compiles in 4.0.11. The error produced is:
10: [Static type checking] - Cannot find matching method java.util.Map#put(java.lang.String, java.util.LinkedHashMap<#K, #V>). Please check if the declared type is correct and if the method exists. @ line 10, column 9. testMap.put("test", [:]) ^1 error
Attachments
Issue Links
- is caused by
-
GROOVY-11028 STC: empty map (or list) literal does not type check like emptyMap()
- Closed