Commit 9c315d6
committed
Print
JDK 27 (JDK-8268850) gives a variable declared with `var` a VarTypeTree as
its type, where earlier JDKs have none. This visitor compiles against JDK 21
and has no visitVarType, so it scanned the new node to nothing and every
`var` declaration failed on JDK 27: six golden files in CI, among them
FlexibleConstructor, I959 and B380299722.
declareOne now looks for the `var` token before the type node, the same
reordering google-java-format made in google/google-java-format@075e025c94.
A binding pattern such as `Nested(var i)` has a method of its own, which
now treats a VAR_TYPE node like the missing type of the older JDKs.var from its token, now that JDK 27 gives it a type node1 parent 97358ba commit 9c315d6
2 files changed
Lines changed: 14 additions & 4 deletions
File tree
- open-java-format/src/main/java/com/palantir/javaformat/java
- java14
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3576 | 3576 | | |
3577 | 3577 | | |
3578 | 3578 | | |
3579 | | - | |
| 3579 | + | |
| 3580 | + | |
| 3581 | + | |
| 3582 | + | |
| 3583 | + | |
3580 | 3584 | | |
3581 | 3585 | | |
3582 | 3586 | | |
3583 | 3587 | | |
3584 | 3588 | | |
3585 | 3589 | | |
3586 | | - | |
3587 | | - | |
3588 | 3590 | | |
3589 | 3591 | | |
3590 | 3592 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
116 | 124 | | |
117 | 125 | | |
118 | 126 | | |
119 | 127 | | |
120 | 128 | | |
121 | | - | |
| 129 | + | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
| |||
0 commit comments