Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
12.5
Description
With the given code :
static void testSwitchStatements(Integer i) { switch (i) { case 1, 2 : System.out.println("1"); break; case 3 : System.out.println("3"); break; case Integer i : System.out.println(i); break; } }
We get the hint to covert to rule switch. The output of the hint does not convert the binding pattern to rule switch case.
static void testSwitchStatements(Integer i) { switch (i) { case 1, 2 -> System.out.println("1"); case 3 -> System.out.println("3"); case Integer i : System.out.println(i); break; } }
When running the hint on a switch expression :
switch (p) { case (Integer i && (i > 10)): return (String) o1; default : return (String) o2; }
The output is multiple default statements.
return (String) (switch (p) { default -> o1; default -> o2; });
Attachments
Issue Links
- links to