Commit 1a87579
Format type annotation as part of the type, not part of the modifiers list
Given e.g. `@Deprecated @nullable Object foo() {}`, prefer this:
```
@deprecated
@nullable Object foo() {}
```
instead of:
```
@deprecated
@nullable
Object foo() {}
```
The implementation is complicated by the fact that the AST doesn't store
source position information for modifiers, and there's no requirement that
declaration annotations, modifiers, and type annotations appear in any
particular order in source.
To work around this, we examine the token stream to figure out the ordering
of the modifiers and annotations.
#5
PiperOrigin-RevId: 3927696091 parent 0051153 commit 1a87579
7 files changed
Lines changed: 398 additions & 68 deletions
File tree
- core
- src
- main/java/com/google/googlejavaformat
- java
- java14
- test/resources/com/google/googlejavaformat/java/testdata
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
281 | 283 | | |
282 | 284 | | |
283 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
284 | 308 | | |
285 | 309 | | |
286 | 310 | | |
| |||
0 commit comments