RFR: 8283782: Redundant verification of year in LocalDate::ofEpochDay [v2]

Roger Riggs rriggs at openjdk.java.net
Tue Mar 29 14:22:48 UTC 2022


On Tue, 29 Mar 2022 14:07:41 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> In `LocalDate::ofEpochDays` we validate the epoch day input, then we also validate the year derived from that value. This second validation is redundant since the minimum and maximum valid epoch day line up with the first and last day of the minimum and maximum valid year, respectively. This patch replace this redundant runtime validation with a test. 
>> 
>> This reduces code complexity (increasing chance for inlining to happen) and removes a couple of branches from generated code.
>
> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Sparse out the range of offsets tested

Thanks

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

Marked as reviewed by rriggs (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8014


More information about the core-libs-dev mailing list