You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/05/02 02:04:14 UTC

[jira] [Closed] (GROOVY-2972) groovy.lang.ObjectRange.size() disobeys its contract for large ranges of Long values.

     [ https://issues.apache.org/jira/browse/GROOVY-2972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-2972.
-----------------------------

> groovy.lang.ObjectRange.size() disobeys its contract for large ranges of Long values.
> -------------------------------------------------------------------------------------
>
>                 Key: GROOVY-2972
>                 URL: https://issues.apache.org/jira/browse/GROOVY-2972
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 1.5.6, 1.6-beta-1
>            Reporter: Christian Semrau
>            Assignee: Paul King
>            Priority: Minor
>             Fix For: 2.5.0-alpha-1
>
>
> groovy.lang.ObjectRange.size() disobeys its contract for large ranges of Long values: "Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE."
> println (new ObjectRange(0L, (long)Integer.MAX_VALUE).size())  // -2147483648
> println (new ObjectRange(0L, (2L<<32)-2).size())  // -1
> A similar error is to be expected for BigDecimal ranges and other ranges larger than Integer.MAX_VALUE, though with other kinds of ranges the computation of size takes a while.
> Expected behaviour:
> assert Integer.MAX_VALUE == new ObjectRange(0L, Integer.MAX_VALUE + 1L).size()



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)