Commit f4bf910
Keep a tabular array initializer with mixed signs in rows
An array initializer written in rows, such as a table of coordinates,
keeps its rows when every column holds expressions of the same kind.
A column that mixed 95.0 with -95.0 or +95.0 did not count as one kind,
because a signed number is a unary expression in javac's tree, so the
whole table collapsed into one line, or into a filled block.
This ports google/google-java-format#406 by Andrew Reid, which fixes
google/google-java-format#400: a unary expression counts as the kind
of its operand for that comparison. The golden
TabularMixedSignInitializer comes from upstream, with the expected
output in this project's style.
The 15,747 files of the JDK 21 sources format exactly as before.1 parent 746fb60 commit f4bf910
3 files changed
Lines changed: 41 additions & 1 deletion
File tree
- open-java-format/src
- main/java/com/palantir/javaformat/java
- test/resources/com/palantir/javaformat/java/testdata
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3468 | 3468 | | |
3469 | 3469 | | |
3470 | 3470 | | |
3471 | | - | |
| 3471 | + | |
| 3472 | + | |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
| 3477 | + | |
3472 | 3478 | | |
3473 | 3479 | | |
3474 | 3480 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments