<i18n dev> RFR: 8313813: Field sun.util.calendar.CalendarDate#forceStandardTime is never set [v2]

Andrey Turbanov aturbanov at openjdk.org
Wed Sep 13 20:00:41 UTC 2023


On Wed, 13 Sep 2023 19:46:08 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> Please review this PR which is a continuation of [JDK-6453901](https://bugs.openjdk.org/browse/JDK-6453901) to remove unused code from the _sun.util.Calendar_ classes.
>> 
>> `forceStandardTime` is always false.
>> 
>> In addition, `locale` is never by used by _CalendarDate_ or any inheritors and can be removed.
>> 
>> As a result, _ImmutableGregorianDate_ no longer needs to override the _setLocale_ method and throw UnsupportedOperationException.
>
> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove isStandardTime() and inline as false

src/java.base/share/classes/sun/util/calendar/AbstractCalendar.java line 169:

> 167:             }
> 168:             // adjust time zone and daylight saving
> 169:             int[] offsets = new int[2];

Let's move array allocation only to `if (zi instanceof ZoneInfo) {` case

src/java.base/share/classes/sun/util/calendar/AbstractCalendar.java line 177:

> 175:             //    as 1:30am DT/0:30am ST (before transition)
> 176:             if (zi instanceof ZoneInfo) {
> 177:                 zoneOffset = ((ZoneInfo)zi).getOffsetsByWall(ms, offsets);

let's use pattern matching for instanceof

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15726#discussion_r1325015164
PR Review Comment: https://git.openjdk.org/jdk/pull/15726#discussion_r1325015642


More information about the i18n-dev mailing list