RFR: 8303919: Instant.ofEpochMilli says it can throw an exception that it can't
Roger Riggs
rriggs at openjdk.org
Thu Mar 9 21:07:15 UTC 2023
On Thu, 9 Mar 2023 19:49:29 GMT, Eamonn McManus <emcmanus at openjdk.org> wrote:
> Instant.ofEpochMilli says this:
>
>
> @throws DateTimeException if the instant exceeds the maximum or minimum instant
>
>
> But that can't happen. Even given `Long.MIN_VALUE` or `Long.MAX_VALUE` it does not throw. That's already implicitly tested in [`TestInstant`](https://github.com/openjdk/jdk/blob/a9dba565688a29bef8626488c47519008dcadbe8/test/jdk/java/time/test/java/time/TestInstant.java#L84), which calls it with both those values.
You're picking on a fine point here that is data dependent, and there's not much value in changing it.
Also, since the spec of `ofEpochMilli` is changing it will need a CSR.
-------------
PR: https://git.openjdk.org/jdk/pull/12958
More information about the core-libs-dev
mailing list