Skip to content

fix(auth): refine JSpecify nullability annotations for core ADC credentials - #14162

Draft
lqiu96 wants to merge 3 commits into
mainfrom
fix_auth_adc_credentials_nullability
Draft

fix(auth): refine JSpecify nullability annotations for core ADC credentials#14162
lqiu96 wants to merge 3 commits into
mainfrom
fix_auth_adc_credentials_nullability

Conversation

@lqiu96

@lqiu96 lqiu96 commented Aug 21, 2026

Copy link
Copy Markdown
Member

Refines JSpecify nullability annotations across core ADC credential classes:

  • Type-Use Placement & Nullability: Annotate optional fields, getters, and builder setters/fields with @Nullable across:
    • ComputeEngineCredentials
    • AppEngineCredentials (both appengine and oauth2_http modules)
    • DefaultCredentialsProvider
    • ImpersonatedCredentials
    • GdchCredentials
    • CloudShellCredentials
    • DownscopedCredentials
    • IdTokenCredentials
    • IdTokenProvider
  • Preconditions: Standardize on com.google.common.base.Preconditions over com.google.api.client.util.Preconditions.
  • Builder Copy Constructors: Ensure builder copy constructors properly preserve all fields and chain super(credentials).
@lqiu96
lqiu96 requested review from a team as code owners August 21, 2026 20:30
@lqiu96
lqiu96 marked this pull request as draft August 21, 2026 20:32

@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 systematically adds @Nullable and @Override annotations across various Google credential classes and their builders to enhance null safety and code clarity. It also refactors some exception message formatting and simplifies a null check in IdentityPoolCredentials. Feedback on these changes highlights a double-space typo introduced in an exception message within ComputeEngineCredentials.java, which should be corrected to a single space for consistency.

@lqiu96
lqiu96 force-pushed the fix_auth_adc_credentials_nullability branch from 617607c to 8b30685 Compare August 21, 2026 22:10
@lqiu96 lqiu96 changed the title fix(auth): refine JSpecify nullability annotations for ADC credential types Aug 21, 2026
…ntials

Refine JSpecify nullability annotations across core ADC credential types:
- Annotate optional fields, getters, and builder setters/fields with @nullable across AccessToken, ComputeEngineCredentials, AppEngineCredentials, DefaultCredentialsProvider, ImpersonatedCredentials, GdchCredentials, CloudShellCredentials, DownscopedCredentials, IdTokenCredentials, and IdTokenProvider.
- Annotate EnvironmentProvider and SystemEnvironmentProvider getEnv methods with @nullable.
- Remove redundant final modifiers on private methods in DefaultCredentialsProvider.
- Ensure correct JSpecify type-use annotation placements on fields, return types, and parameters.
- Migrate Preconditions imports to com.google.common.base.Preconditions.
- Ensure builder copy constructors properly preserve all fields and chain super(credentials).
@lqiu96
lqiu96 force-pushed the fix_auth_adc_credentials_nullability branch from 8b30685 to 0c59b08 Compare August 21, 2026 22:21
lqiu96 added a commit that referenced this pull request Aug 25, 2026
…nt credentials (#14164)

Stacked on #14162.

Refines JSpecify nullability annotations across
ExternalAccountCredentials and subclasses:
- **Type-Use Placement & Nullability**: Annotate optional fields,
getters, and builder setters/fields with `@Nullable` across:
  - `ExternalAccountCredentials`
  - `IdentityPoolCredentials`
  - `AwsCredentials`
  - `PluggableAuthCredentials`
  - `ExternalAccountAuthorizedUserCredentials`
- **Preconditions**: Standardize on
`com.google.common.base.Preconditions` over
`com.google.api.client.util.Preconditions`.
- **Builder Copy Constructors**: Ensure builder copy constructors
properly preserve all fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant