Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.5
-
None
-
None
Description
Before Groovy 3, ArrayExpression#sizeExpression never was null, because you could only write new Object[0][1], but {{new Object[] { 1, 2 }}} was not valid syntax.
Now with Groovy 3 both syntaxes are valid.
In the former case you get for expressions an empty list and for sizeExpression a list with the two size expressions.
In the latter case you get for expressions a list with the two member expressions and for sizeExpression you get null.
This is somewhat unexpected and inconsistent.
Some code (Spock currently does unless https://github.com/spockframework/spock/pull/1203/files gets merged) might assume sizeExpression is always non-null as it always was.
I asked Paul and he said this should probably be fixed on Groovy side to also provide an empty list here, so here is the according issue.