[ 
https://issues.apache.org/jira/browse/GROOVY-10238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10238:
---------------------------------
    Fix Version/s: 3.0.15

> @CompileStatic @Canonical inner class throws RTE: NoSuchMethodError: 
> java.util.Map.withDefault
> ----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10238
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10238
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 3.0.9
>         Environment: Windows 10, Java 11.0.11, IntelliJ 2021.1.1
>            Reporter: mgroovy
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.0-beta-2, 3.0.15
>
>
> Another when-the-stars-align-bug:
> {code:java}
> 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 }
>       }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to