groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: Groovy 2.5.1 array issue
Date Thu, 26 Jul 2018 15:06:17 GMT
We took the opportunity with 2.5 to fix a long-known difference in behavior
between Java and Groovy. It is listed in the release notes as a breaking
change.
(Basically if you always stick with just the stack methods (push/pop) or
just the list methods (most other operations) you will be okay but if you
mix and match you need to change.

On Fri, Jul 27, 2018 at 12:39 AM Paolo Di Tommaso <paolo.ditommaso@gmail.com>
wrote:

> Dear all,
>
> I've found a evil change in the 2.5.1 when using an array list.
>
>
> The following snippet is OK on 2.4.x
>
>     def stack = new ArrayList()
>     stack.push('a')
>     stack.push('b')
>     stack.push('c')
>     assert stack.join('.') == 'a.b.c'
>
>
> When using 2.5.1 it the assertion fails
>
>
> stack.join('.') == 'a.b.c'
> |     |         |
> |     c.b.a     false
> [c, b, a]       2 differences (60% similarity)
>                 (c).b.(a)
>                 (a).b.(c)
>
>
> It looks the semantic of `push` is changed. Is that expected?
>
>
> p
>

Mime
View raw message