diff --git a/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java index 85ac86b4b..f603ee2db 100644 --- a/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java +++ b/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java @@ -395,6 +395,7 @@ public static ExternalAccountCredentials fromStream( * @param transportFactory HTTP transport factory, creates the transport used to get access tokens * @return the credentials defined by the JSON */ + @SuppressWarnings("unchecked") static ExternalAccountCredentials fromJson( Map json, HttpTransportFactory transportFactory) { checkNotNull(json); diff --git a/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java b/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java index ea7166184..6fa9e6f41 100644 --- a/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java +++ b/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java @@ -65,6 +65,7 @@ public class IdentityPoolCredentialSource extends ExternalAccountCredentials.Cre * *

Optional headers can be present, and should be keyed by `headers`. */ + @SuppressWarnings("unchecked") public IdentityPoolCredentialSource(Map credentialSourceMap) { super(credentialSourceMap); diff --git a/oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java index f9b90b01b..ef4924826 100644 --- a/oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java +++ b/oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java @@ -361,6 +361,7 @@ public byte[] sign(byte[] toSign) { * @return the credentials defined by the JSON * @throws IOException if the credential cannot be created from the JSON. */ + @SuppressWarnings("unchecked") static ImpersonatedCredentials fromJson( Map json, HttpTransportFactory transportFactory) throws IOException { @@ -418,7 +419,7 @@ public boolean createScopedRequired() { @Override public GoogleCredentials createScoped(Collection scopes) { return toBuilder() - .setScopes(new ArrayList(scopes)) + .setScopes(new ArrayList<>(scopes)) .setLifetime(this.lifetime) .setDelegates(this.delegates) .setHttpTransportFactory(this.transportFactory) diff --git a/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java b/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java index fce0abc12..a1d276bad 100644 --- a/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java +++ b/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java @@ -170,6 +170,7 @@ static String validateOptionalString(Map map, String key, String } /** Return the specified list of strings from JSON or throw a helpful error message. */ + @SuppressWarnings("unchecked") static List validateOptionalListString( Map map, String key, String errorPrefix) throws IOException { Object value = map.get(key); diff --git a/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java b/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java index 1554dd9cb..44406e7f9 100644 --- a/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java +++ b/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java @@ -80,6 +80,7 @@ public class PluggableAuthCredentialSource extends ExternalAccountCredentials.Cr // location. @Nullable final String outputFilePath; + @SuppressWarnings("unchecked") public PluggableAuthCredentialSource(Map credentialSourceMap) { super(credentialSourceMap); diff --git a/oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java b/oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java index b1e384020..b6e73fcce 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java +++ b/oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java @@ -210,6 +210,7 @@ public void refreshAccessToken_withServiceAccountImpersonationOptions() throws I } @Test + @SuppressWarnings("unchecked") public void retrieveSubjectToken() throws IOException { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); @@ -254,6 +255,7 @@ public void retrieveSubjectToken() throws IOException { } @Test + @SuppressWarnings("unchecked") public void retrieveSubjectTokenWithSessionTokenUrl() throws IOException { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java b/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java index ec558cfa8..6d2fe38dc 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java +++ b/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java @@ -346,6 +346,7 @@ public void fromJson_pluggableAuthCredentialsWorkforce() { } @Test + @SuppressWarnings("unchecked") public void fromJson_pluggableAuthCredentials_allExecutableOptionsSet() { GenericJson json = buildJsonPluggableAuthCredential(); Map credentialSourceMap = (Map) json.get("credential_source"); @@ -400,6 +401,7 @@ public void fromJson_pluggableAuthCredentialsWithServiceAccountImpersonationOpti } @Test + @SuppressWarnings("unchecked") public void fromJson_pluggableAuthCredentials_withUniverseDomain() { GenericJson json = buildJsonPluggableAuthCredential(); json.set("universe_domain", "universeDomain"); diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java b/oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java index 16c82c43b..a8208fb65 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java +++ b/oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java @@ -112,6 +112,7 @@ public void addScopeSequence(List... scopes) { } @Override + @SuppressWarnings("unchecked") public LowLevelHttpRequest buildRequest(final String method, final String url) { MockLowLevelHttpRequest request = new MockLowLevelHttpRequest(url) { diff --git a/pom.xml b/pom.xml index ae7bfa08a..164bcdf2a 100644 --- a/pom.xml +++ b/pom.xml @@ -232,7 +232,6 @@ 1.8 1.8 UTF-8 - -Xlint:unchecked