Commit 4ed1716
Accept an annotated C-style array dimension on a parameter
A method parameter declared as "int a @anno []" crashed the formatter
with a VerifyException from visitAnnotatedArrayType: the parameter's
type was printed as a whole, dimensions included, before the name, and
the annotated dimension that belongs after the name had nowhere to go.
Fields and locals were fine, because their path already splits the
dimensions off the type; parameters, resources and catch parameters go
through visitToDeclare, which did not.
This ports the fix for google/google-java-format#374, upstream commit
ed40e472 by cushon, together with the null check that
google/google-java-format#463 (upstream commit e19b7637) added next to
it: a "var" declaration or an untyped lambda parameter has no type
tree to split. The golden I374 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 4ed1716
3 files changed
Lines changed: 31 additions & 2 deletions
File tree
- open-java-format/src
- main/java/com/palantir/javaformat/java
- test/resources/com/palantir/javaformat/java/testdata
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2669 | 2669 | | |
2670 | 2670 | | |
2671 | 2671 | | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
2672 | 2683 | | |
2673 | 2684 | | |
2674 | 2685 | | |
2675 | 2686 | | |
2676 | | - | |
| 2687 | + | |
2677 | 2688 | | |
2678 | 2689 | | |
2679 | 2690 | | |
2680 | 2691 | | |
2681 | 2692 | | |
2682 | 2693 | | |
2683 | | - | |
| 2694 | + | |
2684 | 2695 | | |
2685 | 2696 | | |
2686 | 2697 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments