On Mon, 9 May 2022 22:29:50 GMT, Uwe Schindler <uschind...@openjdk.org> wrote:
>> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Fixed offsets in milliseconds, added test variations, refined Custom ID >> definitions > > src/java.base/share/classes/java/util/TimeZone.java line 539: > >> 537: public static TimeZone getTimeZone(ZoneId zoneId) { >> 538: String tzid = zoneId.getId(); // throws an NPE if null >> 539: if (zoneId instanceof ZoneOffset zo) { > > I like this because it is much faster than the conversion to ZoneId and > parsing it back! It is similar to use of SimpleTimeZone, but this is better > as the returned timezone is unmodifiable, correct? Yes, and it aligns with the other call site (line 588). > test/jdk/java/util/TimeZone/ZoneOffsetRoundTripTest.java line 43: > >> 41: private Object[][] testZoneOffsets() { >> 42: return new Object[][] { >> 43: {ZoneId.of("Z"), 0}, > > I know, `ZoneId.of()` should parse this as a `ZoneOffset` and return a > `ZoneOffset` instance, but maybe add also the other string variants with > prefix (`ZoneId.of("UTC+00:00:01")` or `ZoneId.of("GMT+00:00:01")` as data > items. Maybe also use `ZoneOffset.of()` for the plain zones to be explicit. Added them except "UTC+...", as it is not recognizable as a Custom ID. ------------- PR: https://git.openjdk.java.net/jdk/pull/8606