fix(auth): refine JSpecify nullability for ServiceAccountCredentials and UserCredentials - #14159
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates several credential classes, including GoogleCredentials, OAuth2Credentials, QuotaProjectIdProvider, ServiceAccountCredentials, and UserCredentials, to adopt JSpecify nullability annotations. It also updates the OAuth2Credentials constructor to handle null margins by falling back to default values, and removes redundant null checks in UserCredentials. Feedback suggests explicitly annotating the refreshMargin and expirationMargin parameters in the OAuth2Credentials constructor with @nullable to align with the new null-handling logic.
546cf59 to
a10d03d
Compare
…and UserCredentials
a10d03d to
ee0abbc
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request improves null safety across several credential classes, including GoogleCredentials, OAuth2Credentials, QuotaProjectIdProvider, ServiceAccountCredentials, and UserCredentials, by systematically adding and standardizing @nullable annotations on fields, method parameters, and return types. It also migrates Preconditions imports from com.google.api.client.util to com.google.common.base and simplifies JSON serialization in UserCredentials by removing redundant null checks. No review comments were provided, so there is no additional feedback to address.
Description
Refines JSpecify nullability annotations and checks for
ServiceAccountCredentials,UserCredentials, and their base hierarchy (GoogleCredentials,OAuth2Credentials,QuotaProjectIdProvider).@Nullableannotations.com.google.api.client.util.Preconditionstocom.google.common.base.Preconditions.UserCredentials.