On Wed, 8 Jul 2026 22:08:26 GMT, Naoto Sato <[email protected]> wrote:

> Hi,
> 
> I am not sure that adding a protected method to `java.util.Date` is the right 
> approach. Since `Date` is extensible, an existing subclass may already 
> declare a `getNormalizedYear()` method. With this change, that method would 
> unintentionally override the new method and could change the behavior of 
> `toLocalDate()` or `toLocalDateTime()`. Instead, I would suggest creating a 
> `GregorianCalendar` initialized from the `Date` and deriving the proleptic 
> year from its `ERA` and `YEAR` fields (BC = 1 - YEAR). This would avoid 
> adding a new overrideable API to `Date`.

@naotoj Understood. I have gone with the `GregorianCalendar` approach as 
recommended. I just want to double check that there aren't any possible 
timezone issues when constructing the calendar?

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

PR Comment: https://git.openjdk.org/jdk/pull/31808#issuecomment-4924919413

Reply via email to