Community
Participate
Working Groups
public static void foo(int num) { int res; switch (num) { case 100: res = 1; break; case 200: res = 2; break; case 300,3000: res = 3; break; case 400: res = 4; break; default: res = -1; break; } ; } public static void foo1(int num) { int res= switch (num) { case 100-> 1; case 200-> 2; case 300,3000-> 3; case 400-> 4; default -> -1; }; } One example is given above i.e. convert from the code in #foo to #foo1. The quick assist should also work for other possible scenarios.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/169800
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/169800 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=64e66d61391c45fd9ebc2921120651a0935f145d
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/170129
Gerrit change https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/170129 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=5256fa800b8c1e28d586f881d7266537281f9305
Released for 4.18M1
(In reply to Jeff Johnston from comment #5) > Released for 4.18M1 Thanks, Jeff. @All, this feature has been released for M1 to get an early feedback. Please test and report any issues or possible improvements.
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/170422
Gerrit change https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/170422 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=08521d61943350b320c68baf86c739ec25e95181
2 scenarios when I get only 1 quick assist as "Convert to method" and "Convert to switch expression" is missing: 1. If I select till ";" which ends the switch statement. 2. If I select the code by dragging from down to up.
For testing, please check if the scenarios are already described in the N&N, otheriwse open new bug reports: https://www.eclipse.org/eclipse/news/4.18/jdt.php#switch-expressions
Verified for 4.18M3 using I20201117-0600 build