You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR removes all occurrences of javax.annotation.Nonnull (both imports and annotations) across the gax-java codebase.
Why this change is needed:
As part of the repository-wide migration to JSpecify annotations, classes are annotated with @NullMarked, making all unannotated types non-nullable by default. The legacy javax.annotation.Nonnull annotations are redundant and can be safely removed without changing null-safety semantics.
Changes:
Removed import javax.annotation.Nonnull; and @Nonnull from 30 files across gax, gax-grpc, and gax-httpjson (including test files).
Formatted modified files using fmt-maven-plugin.
Verified that all compilation references to javax.annotation.Nonnull under gax-java have been eliminated.
The reason will be displayed to describe this comment to others. Learn more.
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.
The reason will be displayed to describe this comment to others. Learn more.
The null check Preconditions.checkNotNull(resumptionStrategy) is performed twice in a row. We can simplify this by directly assigning the result of Preconditions.checkNotNull(resumptionStrategy) to this.resumptionStrategy.
Ensure that null checks and validation steps are not redundant with checks already performed by upstream callers or preceding logic in the same method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes all occurrences of
javax.annotation.Nonnull(both imports and annotations) across thegax-javacodebase.Why this change is needed:
As part of the repository-wide migration to JSpecify annotations, classes are annotated with
@NullMarked, making all unannotated types non-nullable by default. The legacyjavax.annotation.Nonnullannotations are redundant and can be safely removed without changing null-safety semantics.Changes:
import javax.annotation.Nonnull;and@Nonnullfrom 30 files acrossgax,gax-grpc, andgax-httpjson(including test files).fmt-maven-plugin.javax.annotation.Nonnullundergax-javahave been eliminated.