RFR: 8267587: Update java.util to use enhanced switch

Daniel Fuchs dfuchs at openjdk.java.net
Mon May 24 13:50:12 UTC 2021


On Mon, 24 May 2021 04:20:23 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?

src/java.base/share/classes/java/util/regex/CharPredicates.java line 217:

> 215:             case "WORD" -> WORD();
> 216:             default -> null;
> 217:         };

This file has lots of changes which are difficult to review. Maybe it should be split out of this PR.

src/java.base/share/classes/java/util/zip/ZipOutputStream.java line 261:

> 259:             ZipEntry e = current.entry;
> 260:             switch (e.method) {
> 261:                 case DEFLATED -> {

Same remark here - it's not clear what's going on.

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

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


More information about the core-libs-dev mailing list