Closed
Description
For the following code, I would expect line breaks to be added at the arrows (->
) of the rules of the switch expression:
public class Test {
public String f(int i) {
return switch (i) {
case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 -> "looooooooooooooooooooooooooooooooooooooooong expression";
default -> "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong expression";
};
}
}
However, google-java-format 1.15.0 formats it like this:
public class Test {
public String f(int i) {
return switch (i) {
case 0,
1,
2,
3,
4,
5,
6,
7,
8,
9 -> "looooooooooooooooooooooooooooooooooooooooong expression";
default -> "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"
+ " expression";
};
}
}
It even prefers breaking up the string over a line break at the arrow. Please increase the priority of line breaking at the arrow. I guess it should be of higher priority than the list of cases and anything within the expression.
Metadata
Metadata
Assignees
Labels
No labels