RFR: 8303919: Instant.ofEpochMilli says it can throw an exception that it can't [v2]
Roger Riggs
rriggs at openjdk.org
Tue May 2 21:46:18 UTC 2023
On Tue, 2 May 2023 19:54:14 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.
>
> Eamonn McManus has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - Merge branch 'openjdk:master' into ofepochmilli
> - 8303919: Instant.ofEpochMilli javadoc bug
>
> 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.
Looks good to me. Thanks
-------------
Marked as reviewed by rriggs (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/12958#pullrequestreview-1409931977
More information about the core-libs-dev
mailing list