On Thu, 9 Mar 2023 22:07:17 GMT, Roger Riggs <rri...@openjdk.org> wrote:

> I see your point, but no one has stumbled into/over it before.
> Rationalizing here...
> The presence of the exception is a reminder that there are values of epoch 
> milliseconds that `Instant` can not represent.
> It is also the case that `long` cannot represent them either.
> For example `Instant.MIN.toEpochMilli()` throws and the method 
> `Instant.ofEpochSecond(sec, nanos)` throws with Long.MIN_VALUE and 
> Long.MAX_VALUE.

I'm surprised it hasn't come up as declaring that it throws DateTimeException 
"if the instant exceeds the maximum or minimum instant" is a testable 
assertion. Maybe as part of this removal there should be an apiNote will some 
verbiage on what can be represented.

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

PR: https://git.openjdk.org/jdk/pull/12958

Reply via email to