google / google/google-java-format

Block-like array initializers are not preserved

オープン
#572 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
6.2k
フォーク
937
平均マージ
6分
マージ済み PR(30日)
3

説明

The [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html#s4.8.3-arrays) specifies that arrays may be formatted in a block-like fashion, however google-java-format clobbers this to one line per element.

For example, the following:

```
protected static final byte[] TEST_ARRAY =
new byte[] {
(byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0xFF, (byte) 0xFF
};
```
becomes
```
protected static final byte[] TEST_ARRAY =
new byte[] {
(byte) 0x31,
(byte) 0x32,
(byte) 0x33,
(byte) 0x34,
(byte) 0x35,
(byte) 0x36,
(byte) 0xFF,
(byte) 0xFF
};
```

For larger formatted constant definitions, formatting is essential to preserving understanding of the structure. It seems like preserving formatting should either be default behaviour, or an option.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。