Skip to content

Commit 8ce55b5

Browse files
committed
Remove useless asserts, and migrate an error closer to API
1 parent bbd8e7f commit 8ce55b5

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

  • web
    • client-api/src/main/java/io/deephaven/web/client/api
    • shared-beans/src/main/java/io/deephaven/web/shared/data

web/client-api/src/main/java/io/deephaven/web/client/api/JsRangeSet.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public class JsRangeSet {
2424
private final RangeSet range;
2525

2626
public static JsRangeSet ofRange(double first, double last) {
27+
if (first > last) {
28+
throw new IllegalStateException(first + " > " + last);
29+
}
2730
return new JsRangeSet(RangeSet.ofRange((long) first, (long) last));
2831
}
2932

web/shared-beans/src/main/java/io/deephaven/web/shared/data/Range.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package io.deephaven.web.shared.data;
55

66
import javax.annotation.Nonnull;
7-
import java.io.Serializable;
87

98
/**
109
* Describes a contiguous range of at least one item. Equals/hashcode compare both start and end, but comparing Range
@@ -15,15 +14,7 @@ public class Range implements Comparable<Range> {
1514
private final long first;
1615
private final long last;
1716

18-
// serialization
19-
Range() {
20-
this(0, 0);
21-
}
22-
2317
public Range(long first, long last) {
24-
if (first > last) {
25-
throw new IllegalStateException(first + " > " + last);
26-
}
2718
this.first = first;
2819
this.last = last;
2920
}
@@ -70,13 +61,10 @@ public Range[] minus(Range range) {
7061
// otherwise either the subtracted section's start is within our range _or_ its end is within our range,
7162
// and we can use that to only produce the one range we need to return
7263
if (range.first <= first) {
73-
assert range.last >= first : "removed range expected to not end before existing range";
7464
return new Range[] {
7565
new Range(range.last + 1, last)
7666
};
7767
} else {
78-
assert range.last >= last : "removed range expected to end by the end of the existing range";
79-
assert range.first <= last : "removed range expected to start before existing range";
8068
return new Range[] {
8169
new Range(first, range.first - 1)
8270
};

0 commit comments

Comments
 (0)