google / google/google-java-format

Incorrect comment indentation inside switch statements on case that is not first

未关闭
#1,155 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
6.2k
派生
937
平均合并
6 分钟
30 天内合并 PR
3

描述

continuation of https://github.com/google/google-java-format/issues/1147

```
$ javac Test.java
$ cat Test.java
public class Test {
public void check1(int x) {
switch (x) {
case 1:
x = x + 1;
/* fall-through*/ case 2:
;
default:
return;
}
}
}

$ java -jar google-java-format-1.23.0-all-deps.jar Test.java > TestUpdated.java
$ diff -u Test.java TestUpdated.java
--- Test.java 2024-09-01 07:31:37.268757862 -0700
+++ TestUpdated.java 2024-09-01 07:31:54.329333795 -0700
@@ -3,7 +3,7 @@
switch (x) {
case 1:
x = x + 1;
- /* fall-through*/ case 2:
+ /* fall-through*/ case 2:
;
default:
return;

$ cat TestUpdated.java
public class Test {
public void check1(int x) {
switch (x) {
case 1:
x = x + 1;
/* fall-through*/ case 2:
;
default:
return;
}
}
}
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。