google / google/google-java-format

comment after class that has implements cause wrong indentation

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

描述

Indention of `implements` becomes 0, but should be +4 (as it is line wrap) from 0, so 4.
```
$ cat Test.java
/** Tetsing. */
public class Test // comment
implements Runnable, Cloneable {

}

$ java -jar google-java-format-1.23.0-all-deps.jar Test.java > TestUpdated.java

$ diff -u Test.java TestUpdated.java
--- Test.java 2024-07-31 06:29:22.086232824 -0700
+++ TestUpdated.java 2024-07-31 06:33:39.001224613 -0700
@@ -1,5 +1,3 @@
/** Tetsing. */
public class Test // comment
- implements Runnable, Cloneable {
-
-}
+implements Runnable, Cloneable {}

$ cat TestUpdated.java
/** Tetsing. */
public class Test // comment
implements Runnable, Cloneable {}

```

Workaround is to remove trailing comment
but better to handle/format it eventually in proper way.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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