RFR: 8366829: Add constants for the Duration MIN/MAX values

Roger Riggs rriggs at openjdk.org
Mon Sep 29 19:17:29 UTC 2025


On Fri, 26 Sep 2025 23:06:36 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

I'd suggest describing it as a sentinel value, not suitable for adding or subtracting from any Temporal value due to the potential to overflow and throwing of ArithmeticException. 
Should not be used with `plus` or `minus` on any Temporal value.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27534#issuecomment-3348653060


More information about the core-libs-dev mailing list