On Tue, 25 May 2021 14:57:22 GMT, Patrick Concannon <pconcan...@openjdk.org> wrote:
>> Hi, >> >> Could someone please review my code for updating the code in the `java.io`, >> `java.math`, and `java.text` packages to make use of the switch expressions? >> >> Kind regards, >> Patrick > > Patrick Concannon has updated the pull request with a new target base due to > a merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains three additional > commits since the last revision: > > - 8267670: Updated code to use yield > - Merge remote-tracking branch 'origin/master' into JDK-8267670 > - 8267670: Update java.io, java.math, and java.text to use switch expressions src/java.base/share/classes/java/io/ObjectStreamClass.java line 2172: > 2170: switch (typeCodes[i]) { > 2171: case 'L', '[' -> vals[offsets[i]] = > unsafe.getReference(obj, readKeys[i]); > 2172: default -> throw new InternalError(); suggest: vals[offsets[i]] = switch (typeCodes[i]) { case 'L', '[' -> unsafe.getReference(obj, readKeys[i]); default -> throw new InternalError(); src/java.base/share/classes/java/io/StreamTokenizer.java line 787: > 785: case TT_WORD -> ret = sval; > 786: case TT_NUMBER -> ret = "n=" + nval; > 787: case TT_NOTHING -> ret = "NOTHING"; This is not correct, the assignments to ret in these case arms is redundant. ------------- PR: https://git.openjdk.java.net/jdk/pull/4182