fix(auth): refine JSpecify nullability annotations for external account credentials - #14164
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves nullability safety across several credential classes (including AwsCredentials, ExternalAccountAuthorizedUserCredentials, ExternalAccountCredentials, IdentityPoolCredentials, and PluggableAuthCredentials) by adding @nullable annotations to fields, getters, and builder setters, as well as adding missing @OverRide annotations. Feedback on the changes suggests restoring the @nullable annotation on getExecutableHandler() in PluggableAuthCredentials.java because the handler can indeed be null.
…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).
8b30685 to
0c59b08
Compare
91b799f to
ffa7391
Compare
…nt credentials Refine JSpecify nullability annotations across ExternalAccountCredentials and subclasses: - Annotate optional fields, getters, and builder setters/fields with @nullable across ExternalAccountCredentials, IdentityPoolCredentials, AwsCredentials, PluggableAuthCredentials, and ExternalAccountAuthorizedUserCredentials. - 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.
ffa7391 to
e33395e
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates multiple credential classes and their builders to improve nullability annotations, add missing @OverRide annotations, and simplify string checks. However, several issues were identified in the review: the removal of .setRefreshToken(refreshToken) in ExternalAccountAuthorizedUserCredentials.fromJson causes the refresh token to be ignored, and removing the null check for scopes in IdentityPoolCredentials could lead to a NullPointerException. Additionally, the overridden setServiceAccountImpersonationOptions methods in AwsCredentials.Builder, IdentityPoolCredentials.Builder, and PluggableAuthCredentials.Builder should be annotated with @nullable to maintain consistency with the parent class.
…nt credentials Refine JSpecify nullability annotations across ExternalAccountCredentials and subclasses: - Annotate optional fields, getters, and builder setters/fields with @nullable across ExternalAccountCredentials, IdentityPoolCredentials, AwsCredentials, PluggableAuthCredentials, and ExternalAccountAuthorizedUserCredentials. - 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.
d06210a to
7f58e13
Compare
whowes
left a comment
There was a problem hiding this comment.
In general LG, left one comment
…ithub.com:googleapis/google-cloud-java into fix_auth_external_account_credentials_nullability
Pull request was closed
Stacked on #14162.
Refines JSpecify nullability annotations across ExternalAccountCredentials and subclasses:
@Nullableacross:ExternalAccountCredentialsIdentityPoolCredentialsAwsCredentialsPluggableAuthCredentialsExternalAccountAuthorizedUserCredentialscom.google.common.base.Preconditionsovercom.google.api.client.util.Preconditions.