google / google/google-java-format

Failed reformatting on simultaneous declarations

未關閉
#104 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
non-whitespace
主要語言
Java
星號
6.2k
分支
937
平均合併
6 分鐘
30 天內合併 PR
3

描述

Hi there,

I meet a problem when trying to use google-java-format to re-format on simultaneous declarations in a java file:

According to Google Java Style Guide [4.8.2-variable-declarations](https://google.github.io/styleguide/javaguide.html#s4.8.2-variable-declarations):

>Every variable declaration (field or local) declares only one variable: declarations such as `int a, b;` are not used.

However, given java file:

```java
public class ReplaceColor {
private int oldRed, oldGreen, oldBlue;
private IntRange oldRedRange, oldGreenRange, oldBlueRange;
private boolean isRange;
}
```

using google-java-format would not re-format the simultaneous declarations in above file.

Is this a defect that google-java-format forget to consider about?

If not, could you guys help me a bit on pointing out where should I getting started to hack this project to get this feature in my own fork?

Many thanks & best wishes,

Charles

貢獻指南

開啟貢獻指南

研究方向

Start by reviewing google-java-format's handling of Java variable declarations and the Google Java Style Guide section 4.8.2 cited in the issue. Reproduce the sample with simultaneous declarations, then add coverage for the expected reformatted output; done means each declaration is formatted separately or the behavior is documented as intentional.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。