Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0.9
-
None
-
Windows 10, Java 11.0.11, IntelliJ 2021.1.1
Description
Another when-the-stars-align-bug:
package org.groovy.groovybugs.v3_0_9 import groovy.transform.Canonical import groovy.transform.CompileStatic import org.junit.jupiter.api.Test class Groovy_3_0_9_MapWithDefaultBug { @Test void groovy_3_0_9_MapWithDefaultBug() { final o = new Goo() println "o=$o" } @Canonical @CompileStatic static class Goo { /* Groovy 3.0.9: * Every line below throws: "java.lang.NoSuchMethodError: 'java.util.Map java.util.Map.withDefault(groovy.lang.Closure)'" * Error only occurs for: ## (static) inner class ## @Canonical and @CompileStatic on inner class */ Map<String,Object> m0 = [:].withDefault { new Object() } Map<String,Object> m1 = [:].withDefault { "abc" } Map<String,Object> m2 = [:].withDefault { null } Map m3 = [:].withDefault { null } } }
Attachments
Issue Links
- relates to
-
GROOVY-10919 @MapConstructor Breaks in Groovy4 when combined with @TupleConstructor, fine in Groovy3
- Closed