RFR: 8267587: Update java.util to use enhanced switch [v6]

Daniel Fuchs dfuchs at openjdk.java.net
Thu May 27 13:58:13 UTC 2021


On Wed, 26 May 2021 02:22:42 GMT, Tagir F. Valeev <tvaleev at 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 two additional commits since the last revision:
> 
>  - JapaneseImperialCalendar: use switch expressions
>  - Use yield in java.util.Calendar.Builder.build

Globally looks good.
I haven't reviewed `src/java.base/share/classes/java/util/regex/Pattern.java` due to formatting issues. See also my other remark about `java.util.concurrent`.

src/java.base/share/classes/java/util/concurrent/FutureTask.java line 495:

> 493:      * @return a string representation of this FutureTask
> 494:      */
> 495:     public String toString() {

Classes in java.util.concurrent are handled upstream. It would probably be better to leave them out of this patch. Or synchronize with @DougLea to see how to bring these changes in the upstream repo.

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

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



More information about the security-dev mailing list