You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2021/04/12 09:23:32 UTC
[groovy] 15/25: GROOVY-9649: Fixed NumberRange size calculation
with full-exclusive ranges where from equals to.
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 0a8a8a7ad590c4610973454e15ce5ba767459540
Author: Iiro Kiviluoma <ii...@outlook.com>
AuthorDate: Wed Apr 7 18:07:07 2021 +0300
GROOVY-9649: Fixed NumberRange size calculation with full-exclusive ranges where from equals to.
---
src/main/java/groovy/lang/NumberRange.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/groovy/lang/NumberRange.java b/src/main/java/groovy/lang/NumberRange.java
index ece85c9..8677740 100644
--- a/src/main/java/groovy/lang/NumberRange.java
+++ b/src/main/java/groovy/lang/NumberRange.java
@@ -448,6 +448,10 @@ public class NumberRange extends AbstractList<Comparable> implements Range<Compa
}
void calcSize(Comparable from, Comparable to, Number stepSize) {
+ if (from == to && !inclusiveLeft && !inclusiveRight) {
+ size = 0;
+ return;
+ }
int tempsize = 0;
boolean shortcut = false;
if (isIntegral(stepSize)) {