Skip to content

Commit

Permalink
fix: remove -Xlint:unchecked, suppress all existing violations
Browse files Browse the repository at this point in the history
  • Loading branch information
Noam Lewis committed Nov 7, 2023
1 parent 7e6e937 commit a78a3a5
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,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<String, Object> json, HttpTransportFactory transportFactory) {
checkNotNull(json);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class IdentityPoolCredentialSource extends ExternalAccountCredentials.Cre
*
* <p>Optional headers can be present, and should be keyed by `headers`.
*/
@SuppressWarnings("unchecked")
public IdentityPoolCredentialSource(Map<String, Object> credentialSourceMap) {
super(credentialSourceMap);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,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<String, Object> json, HttpTransportFactory transportFactory) throws IOException {

Expand Down Expand Up @@ -419,7 +420,7 @@ public boolean createScopedRequired() {
@Override
public GoogleCredentials createScoped(Collection<String> scopes) {
return toBuilder()
.setScopes(new ArrayList(scopes))
.setScopes(new ArrayList<>(scopes))
.setLifetime(this.lifetime)
.setDelegates(this.delegates)
.setHttpTransportFactory(this.transportFactory)
Expand Down
1 change: 1 addition & 0 deletions oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ static String validateOptionalString(Map<String, Object> map, String key, String
}

/** Return the specified list of strings from JSON or throw a helpful error message. */
@SuppressWarnings("unchecked")
static List<String> validateOptionalListString(
Map<String, Object> map, String key, String errorPrefix) throws IOException {
Object value = map.get(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class PluggableAuthCredentialSource extends ExternalAccountCredentials.Cr
// location.
@Nullable final String outputFilePath;

@SuppressWarnings("unchecked")
public PluggableAuthCredentialSource(Map<String, Object> credentialSourceMap) {
super(credentialSourceMap);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public void refreshAccessToken_withServiceAccountImpersonationOptions() throws I
}

@Test
@SuppressWarnings("unchecked")
public void retrieveSubjectToken() throws IOException {
MockExternalAccountCredentialsTransportFactory transportFactory =
new MockExternalAccountCredentialsTransportFactory();
Expand Down Expand Up @@ -254,6 +255,7 @@ public void retrieveSubjectToken() throws IOException {
}

@Test
@SuppressWarnings("unchecked")
public void retrieveSubjectTokenWithSessionTokenUrl() throws IOException {
MockExternalAccountCredentialsTransportFactory transportFactory =
new MockExternalAccountCredentialsTransportFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public void fromJson_pluggableAuthCredentialsWorkforce() {
}

@Test
@SuppressWarnings("unchecked")
public void fromJson_pluggableAuthCredentials_allExecutableOptionsSet() {
GenericJson json = buildJsonPluggableAuthCredential();
Map<String, Object> credentialSourceMap = (Map<String, Object>) json.get("credential_source");
Expand Down Expand Up @@ -400,6 +401,7 @@ public void fromJson_pluggableAuthCredentialsWithServiceAccountImpersonationOpti
}

@Test
@SuppressWarnings("unchecked")
public void fromJson_pluggableAuthCredentials_withUniverseDomain() {
GenericJson json = buildJsonPluggableAuthCredential();
json.set("universe_domain", "universeDomain");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public void addScopeSequence(List<String>... scopes) {
}

@Override
@SuppressWarnings("unchecked")
public LowLevelHttpRequest buildRequest(final String method, final String url) {
MockLowLevelHttpRequest request =
new MockLowLevelHttpRequest(url) {
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>
<plugin>
Expand Down

0 comments on commit a78a3a5

Please sign in to comment.