You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Björn Kautler (Jira)" <ji...@apache.org> on 2020/07/27 00:27:00 UTC

[jira] [Created] (GROOVY-9661) Since Groovy 3 ArrayExpression#sizeExpression can suddenly return null

Björn Kautler created GROOVY-9661:
-------------------------------------

             Summary: Since Groovy 3 ArrayExpression#sizeExpression can suddenly return null
                 Key: GROOVY-9661
                 URL: https://issues.apache.org/jira/browse/GROOVY-9661
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 3.0.5
            Reporter: Björn Kautler


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. :)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)