<i18n dev> RFR: 8267670: Update java.io, java.math, and java.text to use switch expressions [v2]

Patrick Concannon pconcannon at openjdk.java.net
Wed May 26 09:00:17 UTC 2021


On Tue, 25 May 2021 15:18:46 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

>> 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();

Comment addressed in e503ed2

> 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.

Comment addressed in e503ed2

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

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


More information about the i18n-dev mailing list