RFR: 8366829: Add constants for the Duration MIN/MAX values [v2]
Roger Riggs
rriggs at openjdk.org
Tue Sep 30 20:51:01 UTC 2025
On Mon, 29 Sep 2025 21:36:35 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> We have [recently discussed][] a possibility of adding the `Duration.MIN` and `Duration.MAX` constants. Can we now start implementation? If and when we are in agreement on this PR, I will file a CSR.
>>
>> I drafted a minimal specification and added some tests. I tried to phrase the spec for `Duration.MIN` in a way that makes it clear that `Duration.MIN` is the most negative value and not the least positive.
>>
>> [recently discussed]: https://mail.openjdk.org/pipermail/core-libs-dev/2025-September/151098.html
>
> Pavel Rappo has updated the pull request incrementally with two additional commits since the last revision:
>
> - Update copyright years
>
> Note: any commit hashes below might be outdated due to subsequent
> history rewriting (e.g. git rebase).
>
> + update src/java.base/share/classes/java/time/temporal/ChronoUnit.java due to 9a54ba1d353
> + update test/jdk/java/time/tck/java/time/TCKDuration.java due to 9a54ba1d353
> - Provide @apiNote as suggested
Calling out these values a sentinels is fine, it emphasizes that they are not simple values for computation.
-------------
Marked as reviewed by rriggs (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27534#pullrequestreview-3286671039
More information about the core-libs-dev
mailing list