You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/12/16 16:48:00 UTC
[jira] [Updated] (GROOVY-6285) Delegate constructor selection using static param types (null safe)
[ https://issues.apache.org/jira/browse/GROOVY-6285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-6285:
--------------------------------
Summary: Delegate constructor selection using static param types (null safe) (was: Delegate constructor selection using static param types (null safety))
> Delegate constructor selection using static param types (null safe)
> -------------------------------------------------------------------
>
> Key: GROOVY-6285
> URL: https://issues.apache.org/jira/browse/GROOVY-6285
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-runtime
> Affects Versions: 2.1.6
> Reporter: frenchyan
> Assignee: Eric Milles
> Priority: Major
> Attachments: glu235.groovy
>
>
> See file attached to reproduce the problem: E1 is an exception class, E2 extends from E1 but define only the constructor with {{String}}.
> using new E2(null) end up calling {{E1(Throwable)}} => calling {{initCause}} then fails because the cause has been already been set.
> I am expecting {{E1(String)}} to be called...
> {code}
> > groovy -version
> Groovy Version: 2.1.6 JVM: 1.7.0_25 Vendor: Oracle Corporation OS: Mac OS X
> > groovy glu235.groovy
> called E1.throwable null
> called E2.string null
> Caught: java.lang.IllegalStateException: Can't overwrite cause
> java.lang.IllegalStateException: Can't overwrite cause
> at java_lang_Throwable$initCause.call(Unknown Source)
> at glu235.run(glu235.groovy:43)
> {code}
> Reproducible with groovy 2.0.7 as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)