On Tue, 25 May 2021 11:49:18 GMT, Tagir F. Valeev <tval...@openjdk.org> 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 one 
> additional commit since the last revision:
> 
>   More vertical alignment

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.

src/java.base/share/classes/java/util/JapaneseImperialCalendar.java line 1371:

> 1369:                     }
> 1370:                 }
> 1371:             }

Pull value assignment out of switch?

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

PR: https://git.openjdk.java.net/jdk/pull/4161

Reply via email to