On Mon, 3 Feb 2025 13:07:54 GMT, Shaojin Wen <s...@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