RFR: 8283782: Redundant verification of year in LocalDate::ofEpochDay
Claes Redestad
redestad at openjdk.java.net
Tue Mar 29 10:45:18 UTC 2022
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.
-------------
Commit messages:
- Explicitly check that year in successfully created LocalDates is valid
- Copyright
- Redundant verification of year in LocalDate::ofEpochDay
Changes: https://git.openjdk.java.net/jdk/pull/8014/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8014&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8283782
Stats: 38 lines in 2 files changed: 33 ins; 2 del; 3 mod
Patch: https://git.openjdk.java.net/jdk/pull/8014.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8014/head:pull/8014
PR: https://git.openjdk.java.net/jdk/pull/8014
More information about the core-libs-dev
mailing list