Unfortunately, if the underlying object is an ArrayListand we're running under Java 16+ and the phase of the moon is inopportune, this will fail in one of a couple of different ways:
A runtime complaint that there is no size property.
An object [] being displayed instead of the number.
This appears to be due to GROOVY-9961 "List "size" property yields an ArrayList, not an integer, on Java 16 RC build 36".
The bottom line is that this behaviour was never guaranteed for an ArrayList and that it's not regarded as a bug in Groovy.
The fix is straightforward: simply replace .size with .size() in both cases, making it explicit that we're talking about the collection's size as determined by the #size method and not an implicit property acquired by pulling out the value of a private field.
It's not possible to test this very well under Java 11, which is what the project is currently built under, although the image ships with Java 17. I'll fix this and add a test, though, which will prevent a recurrence.
There's a place in each of the Groovy templates where the size of the collection of results is processed like this:
Unfortunately, if the underlying object is an
ArrayList
and we're running under Java 16+ and the phase of the moon is inopportune, this will fail in one of a couple of different ways:size
property.[]
being displayed instead of the number.This appears to be due to GROOVY-9961 "List "size" property yields an ArrayList, not an integer, on Java 16 RC build 36".
The bottom line is that this behaviour was never guaranteed for an
ArrayList
and that it's not regarded as a bug in Groovy.The fix is straightforward: simply replace
.size
with.size()
in both cases, making it explicit that we're talking about the collection's size as determined by the#size
method and not an implicit property acquired by pulling out the value of a private field.It's not possible to test this very well under Java 11, which is what the project is currently built under, although the image ships with Java 17. I'll fix this and add a test, though, which will prevent a recurrence.