@@ -67,8 +67,8 @@ public class AwsCredentials extends ExternalAccountCredentials {
6767 private final ExternalAccountSupplierContext supplierContext ;
6868 // Regional credential verification url override. This needs to be its own value so we can
6969 // correctly pass it to a builder.
70- @ Nullable private final String regionalCredentialVerificationUrlOverride ;
71- @ Nullable private final String regionalCredentialVerificationUrl ;
70+ private final @ Nullable String regionalCredentialVerificationUrlOverride ;
71+ private final @ Nullable String regionalCredentialVerificationUrl ;
7272 private final String metricsHeaderValue ;
7373
7474 /** Internal constructor. See {@link AwsCredentials.Builder}. */
@@ -83,7 +83,8 @@ public class AwsCredentials extends ExternalAccountCredentials {
8383 // Check that one and only one of supplier or credential source are provided.
8484 if (builder .awsSecurityCredentialsSupplier != null && builder .credentialSource != null ) {
8585 throw new IllegalArgumentException (
86- "AwsCredentials cannot have both an awsSecurityCredentialsSupplier and a credentialSource." );
86+ "AwsCredentials cannot have both an awsSecurityCredentialsSupplier and a"
87+ + " credentialSource." );
8788 }
8889 if (builder .awsSecurityCredentialsSupplier == null && builder .credentialSource == null ) {
8990 throw new IllegalArgumentException (
@@ -162,7 +163,7 @@ public String retrieveSubjectToken() throws IOException {
162163 /** Clones the AwsCredentials with the specified scopes. */
163164 @ Override
164165 public GoogleCredentials createScoped (Collection <String > newScopes ) {
165- return new AwsCredentials (( AwsCredentials . Builder ) newBuilder (this ).setScopes (newScopes ));
166+ return newBuilder (this ).setScopes (newScopes ). build ( );
166167 }
167168
168169 @ Override
@@ -194,7 +195,7 @@ private String buildSubjectToken(AwsRequestSignature signature)
194195 }
195196
196197 @ VisibleForTesting
197- String getRegionalCredentialVerificationUrl () {
198+ @ Nullable String getRegionalCredentialVerificationUrl () {
198199 return this .regionalCredentialVerificationUrl ;
199200 }
200201
@@ -203,8 +204,7 @@ AwsSecurityCredentialsSupplier getAwsSecurityCredentialsSupplier() {
203204 return this .awsSecurityCredentialsSupplier ;
204205 }
205206
206- @ Nullable
207- public String getRegionalCredentialVerificationUrlOverride () {
207+ public @ Nullable String getRegionalCredentialVerificationUrlOverride () {
208208 return this .regionalCredentialVerificationUrlOverride ;
209209 }
210210
@@ -237,9 +237,9 @@ public Builder toBuilder() {
237237
238238 public static class Builder extends ExternalAccountCredentials .Builder {
239239
240- private AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier ;
240+ private @ Nullable AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier ;
241241
242- private String regionalCredentialVerificationUrlOverride ;
242+ private @ Nullable String regionalCredentialVerificationUrlOverride ;
243243
244244 Builder () {}
245245
@@ -282,30 +282,35 @@ public Builder setRegionalCredentialVerificationUrlOverride(
282282 return this ;
283283 }
284284
285+ @ Override
285286 @ CanIgnoreReturnValue
286287 public Builder setHttpTransportFactory (HttpTransportFactory transportFactory ) {
287288 super .setHttpTransportFactory (transportFactory );
288289 return this ;
289290 }
290291
292+ @ Override
291293 @ CanIgnoreReturnValue
292294 public Builder setAudience (String audience ) {
293295 super .setAudience (audience );
294296 return this ;
295297 }
296298
299+ @ Override
297300 @ CanIgnoreReturnValue
298301 public Builder setSubjectTokenType (String subjectTokenType ) {
299302 super .setSubjectTokenType (subjectTokenType );
300303 return this ;
301304 }
302305
306+ @ Override
303307 @ CanIgnoreReturnValue
304308 public Builder setSubjectTokenType (SubjectTokenTypes subjectTokenType ) {
305309 super .setSubjectTokenType (subjectTokenType );
306310 return this ;
307311 }
308312
313+ @ Override
309314 @ CanIgnoreReturnValue
310315 public Builder setTokenUrl (String tokenUrl ) {
311316 super .setTokenUrl (tokenUrl );
@@ -318,60 +323,71 @@ public Builder setCredentialSource(AwsCredentialSource credentialSource) {
318323 return this ;
319324 }
320325
326+ @ Override
321327 @ CanIgnoreReturnValue
322- public Builder setServiceAccountImpersonationUrl (String serviceAccountImpersonationUrl ) {
328+ public Builder setServiceAccountImpersonationUrl (
329+ @ Nullable String serviceAccountImpersonationUrl ) {
323330 super .setServiceAccountImpersonationUrl (serviceAccountImpersonationUrl );
324331 return this ;
325332 }
326333
334+ @ Override
327335 @ CanIgnoreReturnValue
328336 public Builder setTokenInfoUrl (String tokenInfoUrl ) {
329337 super .setTokenInfoUrl (tokenInfoUrl );
330338 return this ;
331339 }
332340
341+ @ Override
333342 @ CanIgnoreReturnValue
334- public Builder setQuotaProjectId (String quotaProjectId ) {
343+ public Builder setQuotaProjectId (@ Nullable String quotaProjectId ) {
335344 super .setQuotaProjectId (quotaProjectId );
336345 return this ;
337346 }
338347
348+ @ Override
339349 @ CanIgnoreReturnValue
340350 public Builder setClientId (String clientId ) {
341351 super .setClientId (clientId );
342352 return this ;
343353 }
344354
355+ @ Override
345356 @ CanIgnoreReturnValue
346357 public Builder setClientSecret (String clientSecret ) {
347358 super .setClientSecret (clientSecret );
348359 return this ;
349360 }
350361
362+ @ Override
351363 @ CanIgnoreReturnValue
352364 public Builder setScopes (Collection <String > scopes ) {
353365 super .setScopes (scopes );
354366 return this ;
355367 }
356368
369+ @ Override
357370 @ CanIgnoreReturnValue
358371 public Builder setWorkforcePoolUserProject (String workforcePoolUserProject ) {
359372 super .setWorkforcePoolUserProject (workforcePoolUserProject );
360373 return this ;
361374 }
362375
376+ @ Override
363377 @ CanIgnoreReturnValue
364378 public Builder setServiceAccountImpersonationOptions (Map <String , Object > optionsMap ) {
365379 super .setServiceAccountImpersonationOptions (optionsMap );
366380 return this ;
367381 }
368382
383+ @ Override
369384 @ CanIgnoreReturnValue
370385 public Builder setUniverseDomain (String universeDomain ) {
371386 super .setUniverseDomain (universeDomain );
372387 return this ;
373388 }
374389
390+ @ Override
375391 @ CanIgnoreReturnValue
376392 Builder setEnvironmentProvider (EnvironmentProvider environmentProvider ) {
377393 super .setEnvironmentProvider (environmentProvider );
0 commit comments