RFR: 8267670: Update java.io, java.math, and java.text to use switch expressions
    Daniel Fuchs 
    dfuchs at openjdk.java.net
       
    Tue May 25 13:22:03 UTC 2021
    
    
  
On Tue, 25 May 2021 09:37:58 GMT, Patrick Concannon <pconcannon at 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
src/java.base/share/classes/java/io/ObjectStreamField.java line 123:
> 121:             case 'D'      -> type = Double.TYPE;
> 122:             case 'L', '[' -> type = Object.class;
> 123:             default       -> throw new IllegalArgumentException("illegal signature");
Why not assign type here?
    type = switch(signature.charAt(0)) {
                    case 'Z'  -> Boolean.TYPE;
                    ....
-------------
PR: https://git.openjdk.java.net/jdk/pull/4182
    
    
More information about the core-libs-dev
mailing list