On Fri, 25 Sep 2026 20:37:33 GMT, Justin Lu <[email protected]> wrote:
> This PR corrects a case when the explicit DST offset metazone mapping is used > by `SimpleDateFormat` even when a custom time zone is active. > > For example, one can create a custom time zone named "America/Vancouver" that > has no daylight time. The code before this fix would attempt to match the > custom zones total offset to the CLDR metazone dstoffset to determine > daylight time. > > Such custom zones should not consult the metazone dstoffset mapping to > determine their daylight naming. Note that it is fine for custom names to be > used with a standard zone and still go through the metazone mapping. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/java.base/share/classes/java/text/SimpleDateFormat.java line 1310: > 1308: // Only check against instances of ZoneInfo, since the > standard JDK timezones > 1309: // are guaranteed to extend this internal type. > 1310: if (tz instanceof ZoneInfo zi && !zi.isDirty()) { The `dirty` flag is always set to `true` if an instance is created from deserialization (for compatibility with JDK 1.4 😮). We would need to introduce a "true" dirty flag for this purpose. test/jdk/java/text/Format/DateFormat/CustomZoneTest.java line 50: > 48: > 49: private final TimeZone JDK_AMERICA_VANCOUVER = > 50: TimeZone.getTimeZone("America/Vancouver"); The literal "America/Vancouver" appears several times. Making it a static final might avoid typo. test/jdk/java/text/Format/DateFormat/CustomZoneTest.java line 65: > 63: }}; > 64: > 65: // Date in normal standard time range before the permanent transition Probably adding some comment explaining that the most of British Columbia (incl. Vancouver) switched to permanent dst on March 8, 2026 would help. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33074#discussion_r4124574016 PR Review Comment: https://git.openjdk.org/jdk/pull/33074#discussion_r4124644457 PR Review Comment: https://git.openjdk.org/jdk/pull/33074#discussion_r4124630259
