Reaction to JEP 325/JDK-8192963

netbeans at post.cz netbeans at post.cz
Wed Aug 22 09:16:53 UTC 2018


Dear JDK dev.




Let me react to JEP 325 (Switch Expressions) and related https://bugs.
openjdk.java.net/browse/JDK-8192963
(https://bugs.openjdk.java.net/browse/JDK-8192963) as I do know what it is 
background for this, but could that be fixed more like syntactic sugar?




int value = switch(day) -> {
   case 1:
     return 1;
   case 2: 
     return 2:
   ...
};




as de-sugar:

((Function<Integer,Integer>)(arg) -> {           
           switch(arg) {           
               case 1 : 
                   return 1;
               case 2 :
                   return 2;
               default:
                   return 3;                  
           }           
 }).apply(1);




Have a nice.
















More information about the jdk-dev mailing list