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

Eric Milles updated GROOVY-6285:
--------------------------------
    Summary: Null safety: delegate constructor selection using static param 
types  (was: Delegate constructor selection using static param types (null 
safe))

> Null safety: delegate constructor selection using static param types
> --------------------------------------------------------------------
>
>                 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)

Reply via email to