Space before comma in multi-value switch expression case label
See original GitHub issuePrettier-Java 1.0.0
# Options (if any):
--print-width 80
Input:
// code snippet
enum TestEnum {
FOO,
BAR,
BAZ,
}
public class Test {
public void test(TestEnum testEnum) {
switch (testEnum) {
case FOO -> System.out.println("Foo!");
case BAR, BAZ -> System.out.println("Not Foo!");
}
}
}
Output:
// code snippet
enum TestEnum {
FOO,
BAR,
BAZ,
}
public class Test {
public void test(TestEnum testEnum) {
switch (testEnum) {
case FOO -> System.out.println("Foo!");
case BAR ,BAZ -> System.out.println("Not Foo!");
}
}
}
Expected behavior:
No changes made. Specifically, case BAR, BAZ
does not become case BAR ,BAZ
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Using two values for one switch case statement - Stack Overflow
Each break statement terminates the enclosing switch statement. ... can make use of the new form of the switch label using a comma...
Read more >Multivalue eval functions - Splunk Documentation
This function filters a multivalue field based on an arbitrary Boolean expression X. The Boolean expression X can reference ONLY ONE field at...
Read more >Comma-separated labels should be used in Switch with colon ...
This rule reports an issue when multiple cases in a Switch can be grouped into a single comma-separated case. Noncompliant Code Example. //...
Read more >Token Editor using Apply Index for "all values separated by a ...
What you want is the Apply Function area and then choose Split. You can then enter the comma as the split character/string.
Read more >Golang program that uses switch, multiple value cases
A switch statement using multiple value cases correspond to using more than one value in a single case. This is achieved by separating...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I will release it tomorrow I think
We update master a few days ago, so we might need to rollback prior the V7 release