<i18n dev> RFR: 8267587: Update java.util to use enhanced switch [v5]
Tagir F.Valeev
tvaleev at openjdk.java.net
Wed May 26 02:22:45 UTC 2021
On Tue, 25 May 2021 16:47:15 GMT, Brian Goetz <briangoetz at openjdk.org> wrote:
>> Tagir F. Valeev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> More vertical alignment
>
> src/java.base/share/classes/java/util/Calendar.java line 1507:
>
>> 1505: }
>> 1506: case "japanese" -> cal = new JapaneseImperialCalendar(zone, locale, true);
>> 1507: default -> throw new IllegalArgumentException("unknown calendar type: " + type);
>
> Agree with Chris' suggestion here.
Done!
> src/java.base/share/classes/java/util/JapaneseImperialCalendar.java line 1124:
>
>> 1122: return Math.max(LEAST_MAX_VALUES[YEAR], d.getYear());
>> 1123: }
>> 1124: }
>
> A switch with one element here is kind of weird. I would turn this into "return switch (field) { ... }", with two cases, YEAR and default.
Done, also at line 1169
-------------
PR: https://git.openjdk.java.net/jdk/pull/4161
More information about the i18n-dev
mailing list