On Wed, 26 May 2021 02:22:42 GMT, Tagir F. Valeev <[email protected]> wrote:
>> Inspired by PR#4088. Most of the changes are done automatically using
>> IntelliJ IDEA refactoring. Some manual adjustments are also performed,
>> including indentations, moving comments, extracting common cast out of
>> switch expression branches, etc.
>>
>> I also noticed that there are some switches having one branch only in
>> JapaneseImperialCalendar.java. Probably it would be better to replace them
>> with `if` statement?
>
> Tagir F. Valeev has updated the pull request incrementally with two
> additional commits since the last revision:
>
> - JapaneseImperialCalendar: use switch expressions
> - Use yield in java.util.Calendar.Builder.build
src/java.base/share/classes/java/util/JapaneseImperialCalendar.java line 1316:
> 1314: JapaneseImperialCalendar jc = getNormalizedCalendar();
> 1315: LocalGregorianCalendar.Date date = jc.jdate;
> 1316: int normalizedYear = date.getNormalizedYear();
This variable was unused
src/java.base/share/classes/java/util/JapaneseImperialCalendar.java line 1423:
> 1421: case WEEK_OF_MONTH -> {
> 1422: LocalGregorianCalendar.Date jd =
> jcal.getCalendarDate(Long.MAX_VALUE, getZone());
> 1423: if (date.getEra() == jd.getEra() && date.getYear() ==
> jd.getYear()) {
I inverted the `if` condition here, as it was negated and a much shorter branch
was in `else`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4161