You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:33:00 UTC
[jira] [Closed] (GROOVY-10238) @CompileStatic @Canonical inner class throws RTE: NoSuchMethodError: java.util.Map.withDefault
[ https://issues.apache.org/jira/browse/GROOVY-10238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10238.
------------------------------
> @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
>
>
> 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.1#820001)