On Tue, 14 Jul 2026 18:43:56 GMT, Sholto <[email protected]> wrote: >> Yes, I believe year should always be derived from `getYear()`. > > Cool I have made that changed. I have also moved away from the if-else block > to only a BC if block. This brings the logic inline with how it is done in > the `GregorianCalendar` class. > > I realise that with always using `getYear()` we could also create a faster > code path for BC dates by also adding a year 2 BC epoch millisecond and > checking if `getTime()` is less than that. That way we only do the calendar > check for the narrow band of dates we cannot be certain are BC or AD. > However, I recognise this is an extra optimisation which few consumers would > benefit from.
Yes, `getYear()` should always be called, regardless of the era. Otherwise, this would introduce a behavioral change. BC dates could also use the fast path, but the added benefit is limited and likely not worth doubling the complexity. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31808#discussion_r3582236683
