Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.0.1
-
None
Description
The following works fine in 2.x/3x but fails with Groovy 4.0.1
@groovy.transform.CompileStatic class Reproducer { Map<String, ?> formData = [:] Map<String, ?> getCsrfTokenField() { [:] } def broken() { resolveFormData(formData + csrfTokenField) } static Map<String, String> resolveFormData(Map<String, ?> formData) { formData.collectEntries { k, v -> [k, v instanceof Closure ? v().toString() : v] } } static void main(String... args) { println 'compiled successfully' } }
Fails with
[Static type checking] - Cannot call <K,V> org.codehaus.groovy.runtime.DefaultGroovyMethods#plus(java.util.Map<K, V>, java.util.Map<K, V>) with arguments [java.util.Map<java.lang.String, ?>, java.util.Map<java.lang.String, ? extends java.lang.Object>] @ line 11, column 19.
Attachments
Issue Links
- is related to
-
GROOVY-9074 CompileStatic does not throw expected exception
- Resolved