Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9661

Since Groovy 3 ArrayExpression#sizeExpression can suddenly return null

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.5
    • Fix Version/s: 4.0.0-alpha-1, 3.0.6
    • Component/s: None
    • Labels:
      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. 

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              vampire Björn Kautler
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h