Commit 50ebc70
authored
cleanup(gax-java): remove javax.annotation.Nonnull usage (#13959)
This PR removes all occurrences of legacy javax.annotation.Nonnull
annotations and imports across the gax-java codebase, removes the unused
jsr305 dependency, and corrects misplaced/incorrect nullability
annotations in the core modules (gax, gax-grpc, and gax-httpjson).
### Why this change is needed:
As part of the repository-wide migration to JSpecify annotations,
packages/classes are annotated with @NullMarked, making all unannotated
types non-nullable by default.
- The legacy javax.annotation.Nonnull annotations are redundant under
JSpecify semantics and can be safely removed.
- Resolving misplaced nullability signatures and aligning overridden
methods enables compilation checks under NullAway static analysis with
JSpecifyMode=true.
### JSR-305 (`jsr305`) Dependency Removal:
We removed the `com.google.code.findbugs:jsr305` dependency from the
`pom.xml` files. This is not a breaking change for the following
reasons:
* **Why it was removed**: Because we removed all references to the
`javax.annotation` package in the codebase, the Maven dependency
analyzer (`mvn dependency:analyze`) flagged `jsr305` as an **unused
declared dependency**. Since our verification fails on any warning
(`-DfailOnWarning=true`), the dependency had to be removed to pass
presubmit checks.
* **Why it's not a breaking change**: The dependency was declared with
`provided` scope, meaning it was only used during compilation and was
**never** distributed transitively to downstream users. Removing it has
no runtime impact on library consumers.
### Changes:
* Removed `import javax.annotation.Nonnull;` and `@Nonnull` from 30
files across `gax`, `gax-grpc`, and `gax-httpjson` (including test
files).
* Migrated remaining `javax.annotation.Nullable` usages in tests to
JSpecify's `@Nullable` type-use annotation.
* Removed the unused `jsr305` dependency from the `gax-java` module
POMs.
* Fixed type-use annotation placements and annotate missing annotations
* Formatted all modified files using `fmt-maven-plugin`.
* Verified that all compilation and dependency analysis stages pass
cleanly.1 parent 6487543 commit 50ebc70
48 files changed
Lines changed: 170 additions & 284 deletions
File tree
- sdk-platform-java/gax-java
- gax-grpc
- src
- main/java/com/google/api/gax/grpc
- test/java/com/google/api/gax/grpc
- gax-httpjson
- src/main/java/com/google/api/gax/httpjson
- gax
- src
- main/java/com/google/api/gax
- batching
- core
- retrying
- rpc
- tracing
- util
- test/java/com/google/api/gax/rpc/testing
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 84 | + | |
89 | 85 | | |
90 | 86 | | |
91 | 87 | | |
| |||
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| |||
413 | 412 | | |
414 | 413 | | |
415 | 414 | | |
416 | | - | |
| 415 | + | |
417 | 416 | | |
418 | 417 | | |
419 | 418 | | |
| |||
436 | 435 | | |
437 | 436 | | |
438 | 437 | | |
439 | | - | |
| 438 | + | |
440 | 439 | | |
441 | 440 | | |
442 | 441 | | |
| |||
665 | 664 | | |
666 | 665 | | |
667 | 666 | | |
668 | | - | |
669 | 667 | | |
670 | 668 | | |
671 | 669 | | |
| |||
676 | 674 | | |
677 | 675 | | |
678 | 676 | | |
679 | | - | |
| 677 | + | |
680 | 678 | | |
681 | 679 | | |
682 | 680 | | |
| |||
sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallableFactory.java
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
330 | 329 | | |
331 | 330 | | |
332 | 331 | | |
333 | | - | |
| 332 | + | |
334 | 333 | | |
335 | 334 | | |
336 | 335 | | |
| |||
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
270 | 269 | | |
271 | | - | |
| 270 | + | |
272 | 271 | | |
273 | 272 | | |
274 | 273 | | |
| |||
541 | 540 | | |
542 | 541 | | |
543 | 542 | | |
544 | | - | |
545 | 543 | | |
546 | | - | |
| 544 | + | |
| 545 | + | |
547 | 546 | | |
548 | 547 | | |
549 | 548 | | |
| |||
609 | 608 | | |
610 | 609 | | |
611 | 610 | | |
612 | | - | |
613 | 611 | | |
614 | | - | |
| 612 | + | |
615 | 613 | | |
616 | 614 | | |
617 | 615 | | |
| |||
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| |||
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | | - | |
| 70 | + | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
83 | | - | |
84 | 81 | | |
85 | | - | |
| 82 | + | |
86 | 83 | | |
87 | 84 | | |
88 | 85 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | | - | |
564 | | - | |
| 563 | + | |
565 | 564 | | |
566 | 565 | | |
567 | 566 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 75 | + | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
| |||
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| |||
510 | 509 | | |
511 | 510 | | |
512 | 511 | | |
513 | | - | |
| 512 | + | |
514 | 513 | | |
515 | 514 | | |
516 | 515 | | |
| |||
531 | 530 | | |
532 | 531 | | |
533 | 532 | | |
534 | | - | |
| 533 | + | |
535 | 534 | | |
536 | 535 | | |
537 | 536 | | |
| |||
588 | 587 | | |
589 | 588 | | |
590 | 589 | | |
591 | | - | |
592 | 590 | | |
593 | 591 | | |
594 | 592 | | |
| |||
599 | 597 | | |
600 | 598 | | |
601 | 599 | | |
602 | | - | |
| 600 | + | |
603 | 601 | | |
604 | 602 | | |
605 | 603 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
222 | 221 | | |
223 | 222 | | |
224 | 223 | | |
225 | | - | |
| 224 | + | |
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
| |||
0 commit comments