Commit 1858d35
Fix type-use annotation duplication on nested classes and arrays
Type-use annotations placed at the beginning of a return type (e.g. `@Nullable
Enclosing.Inner` or `@Nullable byte[]`) are associated with the left-most
type—the enclosing class type and array component type, respectively.
AutoValue's getReturnTypeAnnotations previously only checked annotations on the
root return type (e.g. `Inner` or `byte[]`), failing to check annotations on
the left-most type as return type. As a result, it treated them as method
declaration annotations and duplicated them onto the generated method.
This fix updates getReturnTypeAnnotations to inspect the left-most type
(unwrapping enclosing declared types and array component types) so type
annotations are correctly excluded from being copied to method declarations.
RELNOTES=n/a
PiperOrigin-RevId: 9603904071 parent a1751e3 commit 1858d35
4 files changed
Lines changed: 109 additions & 14 deletions
File tree
- value/src
- main/java/com/google/auto/value/processor
- test/java/com/google/auto/value/processor
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
92 | 131 | | |
93 | 132 | | |
94 | 133 | | |
| |||
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1236 | 1236 | | |
1237 | 1237 | | |
1238 | 1238 | | |
1239 | | - | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
1240 | 1242 | | |
1241 | 1243 | | |
1242 | 1244 | | |
| |||
1253 | 1255 | | |
1254 | 1256 | | |
1255 | 1257 | | |
| 1258 | + | |
| 1259 | + | |
1256 | 1260 | | |
1257 | 1261 | | |
1258 | 1262 | | |
1259 | | - | |
| 1263 | + | |
1260 | 1264 | | |
1261 | 1265 | | |
1262 | 1266 | | |
| |||
1295 | 1299 | | |
1296 | 1300 | | |
1297 | 1301 | | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
1298 | 1312 | | |
1299 | | - | |
1300 | | - | |
| 1313 | + | |
| 1314 | + | |
1301 | 1315 | | |
1302 | 1316 | | |
1303 | 1317 | | |
| |||
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
340 | 344 | | |
341 | 345 | | |
342 | 346 | | |
| |||
465 | 469 | | |
466 | 470 | | |
467 | 471 | | |
468 | | - | |
| 472 | + | |
| 473 | + | |
469 | 474 | | |
470 | | - | |
| 475 | + | |
471 | 476 | | |
472 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
473 | 480 | | |
474 | 481 | | |
475 | 482 | | |
| |||
Lines changed: 41 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4322 | 4322 | | |
4323 | 4323 | | |
4324 | 4324 | | |
4325 | | - | |
4326 | 4325 | | |
4327 | 4326 | | |
4328 | 4327 | | |
4329 | 4328 | | |
| 4329 | + | |
4330 | 4330 | | |
4331 | | - | |
| 4331 | + | |
| 4332 | + | |
| 4333 | + | |
| 4334 | + | |
| 4335 | + | |
| 4336 | + | |
| 4337 | + | |
| 4338 | + | |
| 4339 | + | |
| 4340 | + | |
| 4341 | + | |
| 4342 | + | |
| 4343 | + | |
| 4344 | + | |
| 4345 | + | |
4332 | 4346 | | |
4333 | 4347 | | |
4334 | 4348 | | |
| |||
4412 | 4426 | | |
4413 | 4427 | | |
4414 | 4428 | | |
4415 | | - | |
4416 | 4429 | | |
4417 | 4430 | | |
4418 | 4431 | | |
4419 | 4432 | | |
| 4433 | + | |
4420 | 4434 | | |
4421 | | - | |
| 4435 | + | |
| 4436 | + | |
| 4437 | + | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
| 4448 | + | |
| 4449 | + | |
4422 | 4450 | | |
4423 | 4451 | | |
4424 | 4452 | | |
| |||
4453 | 4481 | | |
4454 | 4482 | | |
4455 | 4483 | | |
4456 | | - | |
4457 | 4484 | | |
4458 | 4485 | | |
4459 | 4486 | | |
4460 | 4487 | | |
| 4488 | + | |
4461 | 4489 | | |
4462 | | - | |
| 4490 | + | |
| 4491 | + | |
| 4492 | + | |
| 4493 | + | |
| 4494 | + | |
| 4495 | + | |
| 4496 | + | |
| 4497 | + | |
4463 | 4498 | | |
4464 | 4499 | | |
4465 | 4500 | | |
| |||
0 commit comments