Summary
java.time.temporal.ValueRange.of(long, long, long) should throw an InvalidArgumentException on invalid inputs. Similarly of(long, long, long, long) method should throw IAE appropriately.
Problem
of(min, maxSmallest, maxLargest) does not throw an IAE when min is greater than maxSmallest even though it is specified in the method description.
The four-argument overload method also has this issue, as well as it lacks the IAE condition for "minSmallest > minLargest" on which the implementation is throwing the exception.
Solution
of(min, maxSmallest, maxLargest)should throw an IAE whenminis greater thanmaxSmallest.of(minSmallest, minLargest, maxSmallest, maxLargest)should throw an IAE whenminSmallestis greater thanmaxSmallest.- The method description for
of(minSmallest, minLargest, maxSmallest, maxLargest)should describe the IAE condition forminSmallestis greater thanminLargest.
Specification
The @throws clause in the method description for java.time.temporal.ValueRange.of(long, long, long, long) should change from:
* @throws IllegalArgumentException if
* the smallest minimum is greater than the smallest maximum,
* or the smallest maximum is greater than the largest maximum
* or the largest minimum is greater than the largest maximum
to:
* @throws IllegalArgumentException if
* the smallest minimum is greater than the smallest maximum,
* or the smallest maximum is greater than the largest maximum,
* or the largest minimum is greater than the largest maximum,
* or the smallest minimum is greater than the largest minimum
- csr of
-
JDK-8239520 ValueRange.of(long, long, long) does not throw IAE on invalid inputs
-
- Closed
-