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

Eamonn McManus emcmanus at openjdk.org
Thu Mar 9 19:59:34 UTC 2023


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.

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

Commit messages:
 - 8303919: Instant.ofEpochMilli javadoc bug

Changes: https://git.openjdk.org/jdk/pull/12958/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12958&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8303919
  Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/12958.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12958/head:pull/12958

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


More information about the core-libs-dev mailing list