Switch with the arrow syntax + throw not supported
    Michel Trudeau 
    michel.trudeau at oracle.com
       
    Wed Jan 29 14:48:21 UTC 2020
    
    
  
It even fails with the old syntax:
And that’s a regression introduced in JDK 12, as it was working in 11.    We’ll file a bug.
-Michel
On Jan 29, 2020, at 5:48 AM, Remi Forax <forax at univ-mlv.fr> wrote:
Hi all,
this snippet of code doesn't work with jshell.
jshell> var foo = "foo";
  ...> switch(foo) {
  ...>   default -> throw new AssertionError();
  ...> }
foo ==> "foo"
|  Error:
|  unreachable statement
|  }
|   ^
Obviously, it works with javac.
regards,
Rémi
    
    
More information about the kulla-dev
mailing list