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 2023/02/10 21:41:00 UTC

[jira] [Closed] (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 ]

Paul King closed GROOVY-10722.
------------------------------

> 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
>             Fix For: 4.0.8
>
>
> 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)