Skip to content

cleanup(generator): remove javax.annotation.Nonnull usage - #13960

Merged
nnicolee merged 3 commits into
mainfrom
cleanup/generator-remove-javax-nonnull
Aug 5, 2026
Merged

cleanup(generator): remove javax.annotation.Nonnull usage#13960
nnicolee merged 3 commits into
mainfrom
cleanup/generator-remove-javax-nonnull

Conversation

@nnicolee

Copy link
Copy Markdown
Contributor

This PR removes all occurrences of javax.annotation.Nonnull (both imports and annotations) from the codebase of gapic-generator-java.

Why this change is needed:

As part of the migration to JSpecify annotations, generator 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.

Changes:

  • Removed import javax.annotation.Nonnull; and @Nonnull from 4 files in the generator codebase (TypeParser.java, SourceCodeInfoLocation.java, TryCatchStatement.java, and ImportWriterVisitor.java).
  • Formatted the modified files using fmt-maven-plugin.
  • Verified that all compilation references to javax.annotation.Nonnull under gapic-generator-java have been eliminated.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes redundant @Nonnull annotations and their corresponding imports across several files, including TryCatchStatement.java, ImportWriterVisitor.java, SourceCodeInfoLocation.java, and TypeParser.java, as these classes are already annotated with @NullMarked. Feedback on the changes highlights that the body parameter in the addCatch method of TryCatchStatement.java is currently unused and suggests updating the builder to properly record the catch block statements.

@nnicolee
nnicolee requested a review from lqiu96 July 30, 2026 16:14
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@nnicolee
nnicolee marked this pull request as ready for review August 4, 2026 17:34
@nnicolee
nnicolee requested review from a team as code owners August 4, 2026 17:34
@nnicolee
nnicolee merged commit 613a074 into main Aug 5, 2026
402 of 405 checks passed
@nnicolee
nnicolee deleted the cleanup/generator-remove-javax-nonnull branch August 5, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants