cleanup(gax-java): remove javax.annotation.Nonnull usage - #13959
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the @Nonnull annotation and its corresponding javax.annotation.Nonnull import across numerous files in the gax-java library, likely as part of a migration to JSpecify annotations. A review of the changes identified a redundant null check in ServerStreamingCallSettings.java where Preconditions.checkNotNull(resumptionStrategy) is called twice consecutively, which should be simplified.
|
@nnicolee I think there are a few straggling instances I've seen with Can you take a look? I think we can also raise a new PR to do additional cleanup |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request migrates the codebase from JSR-305 nullness annotations (@nonnull, @nullable) to JSpecify annotations (@nullable, @NullMarked). It removes the jsr305 dependency from the Maven POM files across multiple modules (gax-grpc, gax-httpjson, and gax) and updates the Java source files by removing @nonnull annotations (relying on class-level @NullMarked instead) and shifting @nullable annotations to type-use positions. There are no review comments to address, and I have no additional feedback to provide.
7619775 to
5fe253d
Compare
|
|




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.
JSR-305 (
jsr305) Dependency Removal:We removed the
com.google.code.findbugs:jsr305dependency from thepom.xmlfiles. This is not a breaking change for the following reasons:javax.annotationpackage in the codebase, the Maven dependency analyzer (mvn dependency:analyze) flaggedjsr305as an unused declared dependency. Since our verification fails on any warning (-DfailOnWarning=true), the dependency had to be removed to pass presubmit checks.providedscope, 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:
import javax.annotation.Nonnull;and@Nonnullfrom 30 files acrossgax,gax-grpc, andgax-httpjson(including test files).javax.annotation.Nullableusages in tests to JSpecify's@Nullabletype-use annotation.jsr305dependency from thegax-javamodule POMs.fmt-maven-plugin.