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/01/18 18:07:00 UTC

[jira] [Resolved] (GROOVY-10722) AIC via array-based (variadic) constructor null and array arguments

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

Eric Milles resolved GROOVY-10722.
----------------------------------
    Resolution: Fixed

https://github.com/apache/groovy/commit/a3373407add794ba52df8f20479cd3bb352a1050

> AIC via array-based (variadic) constructor null and array arguments
> -------------------------------------------------------------------
>
>                 Key: GROOVY-10722
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10722
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>              Labels: varargs
>
> Follow up from GROOVY-7370. Consider the following:
> {code:groovy}
> class C {
>   C(String... args) {
>     strings = args
>   }
>   public String[] strings
> }
> def x = new C(null) { }
> assert x.strings == null
> def y = new String[0]
> def z = new C( y ) { }
> assert z.strings.length == 0
> {code}
> 7370 handles no arguments for array and more than one.  Passing null is supposed to set the array to null, not pass an array with one null element.  Passing an array through an untyped variable is also a problem.



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