Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indentation of case statements on JDK 17 #654

Merged
merged 1 commit into from Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -251,7 +251,7 @@ public Void visitCase(CaseTree node, Void unused) {
token("default", plusTwo);
} else {
token("case", plusTwo);
builder.open(plusFour);
builder.open(node.getExpressions().size() > 1 ? plusFour : ZERO);
builder.space();
boolean first = true;
for (ExpressionTree expression : node.getExpressions()) {
Expand Down
@@ -0,0 +1,14 @@
public class Foo {
static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1;
static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2;
static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4;

public static int fn(int x) {
switch (x) {
case VERBOSE_WORDY_AND_LENGTHY_ONE | VERBOSE_WORDY_AND_LENGTHY_TWO | VERBOSE_WORDY_AND_LENGTHY_FOUR:
return 0;
default:
return 1;
}
}
}
@@ -0,0 +1,16 @@
public class Foo {
static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1;
static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2;
static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4;

public static int fn(int x) {
switch (x) {
case VERBOSE_WORDY_AND_LENGTHY_ONE
| VERBOSE_WORDY_AND_LENGTHY_TWO
| VERBOSE_WORDY_AND_LENGTHY_FOUR:
return 0;
default:
return 1;
}
}
}