You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Sean Fitts (Jira)" <ji...@apache.org> on 2021/03/05 21:05:00 UTC

[jira] [Comment Edited] (GROOVY-9969) Use of a negative range with Long values results in reversed sequence

    [ https://issues.apache.org/jira/browse/GROOVY-9969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17296320#comment-17296320 ] 

Sean Fitts edited comment on GROOVY-9969 at 3/5/21, 9:04 PM:
-------------------------------------------------------------

-Marking as major as for us it prevents upgrading past 2.5.11.-

Found workaround, so downgrading to minor.


was (Author: sfitts):
Marking as major as for us it prevents upgrading past 2.5.11.

> Use of a negative range with Long values results in reversed sequence
> ---------------------------------------------------------------------
>
>                 Key: GROOVY-9969
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9969
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.5.12, 2.5.14
>            Reporter: Sean Fitts
>            Priority: Major
>
> Use of long values when describing an array range results in a reserved result when it should not.
> For example, the following is true in 2.5.11 and false starting in 2.5.12:
> {code:java}
> [1L, 2L, 3L, 4L, 5L, 6L][(2L .. -2L)] == [3L, 4L, 5L]
> {code}
> The following however is true in all versions of 2.5:
> {code:java}
> [1L, 2L, 3L, 4L, 5L, 6L][(2 .. -2)] == [3L, 4L, 5L]
> {code}
> I believe this bug was introduced in the fix for https://issues.apache.org/jira/browse/GROOVY-8966.  The NumberRange produced reverses the from and to resulting in the reversed sequence.



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