Community
Participate
Working Groups
Consider the following code: package test1; public class X { static int foo(int i) { int tw = 0; switch (i) { case 1 : { int z = 100; break; } default : { break; } } return tw; } public static void main(String[] args) { System.out.print(foo(1)); } } Now add case 100: with a block having a singleton break; The resulting code looks like: package test1; public class X { static int foo(int i) { int tw = 0; switch (i) { case 1 : { int z = 100; break; } case 100: { break; } default : { break; } } return tw; } public static void main(String[] args) { System.out.print(foo(1)); } } The case 100: block format is different. It would be good to address this when the preview feature switch expression becomes a full feature.
Created attachment 277881 [details] Test case patch Dev Notes: A complete test case patch is attached above - Please apply the above to master and run the ASTRSTes to observe the stated behavior.
New Gerrit change created: https://git.eclipse.org/r/138889
(In reply to Eclipse Genie from comment #2) > New Gerrit change created: https://git.eclipse.org/r/138889 Another sample test case failing for switch case formatting.
(In reply to Sarika Sinha from comment #3) > (In reply to Eclipse Genie from comment #2) > > New Gerrit change created: https://git.eclipse.org/r/138889 > > Another sample test case failing for switch case formatting. This is an inherited issue :) - essentially, the same issue as that pointed out in the description and nothing to do with Switch Expression in particular.
Another sample test case failing - From https://bugs.eclipse.org/bugs/show_bug.cgi?id=545261#c10 - Applying the quick assist on 'case 400, 4000' results in bad formatting. public static void foo1(int num) { int res = switch (num) { case 100 -> 1; case 200 -> 2; case 300, 3000 -> 3; case 400, 4000 -> { break 4; } }; }
Moving to 4.14
Bulk move out of 4.14
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/187125
(In reply to Eclipse Genie from comment #8) > New Gerrit change created: > https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/187125 Cherry-picked from the other one. But conflicts need to resolved before any further work.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.