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 2016/06/29 03:25:45 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=15354472#comment-15354472 ]
Paul King commented on GROOVY-2972:
-----------------------------------
Fixed as part of PR #143
> 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
> Priority: Minor
> Fix For: 2.5.0-beta-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.4#6332)