Description
Follow up from GROOVY-7370. Consider the following:
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
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.
Attachments
Issue Links
- is related to
-
GROOVY-6146 Calling a Java vararg method from Groovy with a null argument cast to the vararg type behaves differently than in Java
-
- Closed
-
-
GROOVY-7370 Varargs in constructor are not treated correctly when creating instances of anonymous class
-
- Closed
-
- relates to
-
GROOVY-10840 GroovyCastException on Groovy 3 try-with-resources example after upgrade to Groovy 4
-
- Closed
-