google / google/google-java-format
Block-like array initializers are not preserved
- Ngôn ngữ chính
- Java
- Star
- 6.2k
- Fork
- 937
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
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.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.