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

Pavel Rappo prappo at openjdk.org
Mon Sep 29 21:46:06 UTC 2025


On Mon, 29 Sep 2025 19:07:36 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> 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.

I provided initial `@apiNote`; please have a look. I mentioned that adding an edge value to or subtracting it from an instant should not be done. But do we really need to say anything similar about **all** implementations of `Temporal` here, like you suggested?

Here's my thinking. While it's true in java.time, in the wild, there might be some implementations of `Temporal` which we don't know anything about. Similarly, in the future, java.time might get an implementation of `Temporal` for which it won't be true. Does it make sense, or am I overthinking it?

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

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


More information about the core-libs-dev mailing list