google / google/google-java-format

comment after class that has implements cause wrong indentation

オープン
#1,126 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
6.2k
フォーク
937
平均マージ
6分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。