RFR: 8303919: Instant.ofEpochMilli says it can throw an exception that it can't

Roger Riggs rriggs at openjdk.org
Fri Apr 7 15:38:44 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.

It slipped too far down in my list.  
I Reviewed the CSR; you can mark it finalized.

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

PR Comment: https://git.openjdk.org/jdk/pull/12958#issuecomment-1500395509


More information about the core-libs-dev mailing list