diff --git a/core/src/main/java/com/google/googlejavaformat/java/java17/Java17InputAstVisitor.java b/core/src/main/java/com/google/googlejavaformat/java/java17/Java17InputAstVisitor.java index 486324fb7..a0037edb7 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/java17/Java17InputAstVisitor.java +++ b/core/src/main/java/com/google/googlejavaformat/java/java17/Java17InputAstVisitor.java @@ -19,7 +19,6 @@ import com.google.common.base.Verify; import com.google.common.collect.ImmutableList; -import com.google.googlejavaformat.Indent; import com.google.googlejavaformat.OpsBuilder; import com.google.googlejavaformat.OpsBuilder.BlankLineWanted; import com.google.googlejavaformat.java.JavaInputAstVisitor; @@ -233,11 +232,10 @@ public Void visitCase(CaseTree node, Void unused) { && !node.getBody().getKind().equals(Tree.Kind.BLOCK) ? plusFour : ZERO); - Indent commentIndent = node.getCaseKind().equals(CaseTree.CaseKind.RULE) ? ZERO : plusTwo; if (isDefault) { - token("default", commentIndent); + token("default", ZERO); } else { - token("case", commentIndent); + token("case", ZERO); builder.open(labels.size() > 1 ? plusFour : ZERO); builder.space(); boolean afterFirstToken = false; diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchComment.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchComment.output index ff4753b1e..f1afa6484 100644 --- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchComment.output +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchComment.output @@ -16,7 +16,7 @@ class T { void g(String v) { int x = switch (v) { - // this is a line comment about "zero" + // this is a line comment about "zero" case "zero": return 0; case "one":