<i18n dev> RFR: 8349189: Speed up DateTime parse & format via Class File API [v2]

Stephen Colebourne scolebourne at openjdk.org
Mon Feb 3 13:30:47 UTC 2025


On Mon, 3 Feb 2025 13:07:54 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> src/java.base/share/classes/java/time/temporal/TemporalAccessor.java line 327:
>> 
>>> 325:      * @return the year, from MIN_YEAR to MAX_YEAR
>>> 326:      */
>>> 327:     default int getYear() {
>> 
>> The whole point of `TemporalAccessor` is that it does not have methods like these - it does not assume anything about the temporal.
>
> If these methods are not added here, query will be called during formatting, which will incur some overhead. By providing these methods, if these Fields are not supported by the implementation of the TemporalAccessor, the error reporting behavior will remain the same as before.

To retain the design of java.time, you cannot add these methods.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23384#discussion_r1939378358


More information about the i18n-dev mailing list