From 038d7ec0f3cfdda028084aa19feae7d9062aeea4 Mon Sep 17 00:00:00 2001 From: Tran Ngoc Nhan Date: Sun, 8 Dec 2024 00:55:43 +0700 Subject: [PATCH] Polish diamond operator --- .../authorization/JdbcOAuth2AuthorizationService.java | 2 +- .../client/JdbcRegisteredClientRepository.java | 2 +- ...uth2AuthorizationServerMetadataHttpMessageConverter.java | 4 ++-- .../OAuth2TokenIntrospectionHttpMessageConverter.java | 4 ++-- .../oauth2/server/authorization/jackson2/JsonNodeUtils.java | 6 +++--- .../OidcClientRegistrationHttpMessageConverter.java | 4 ++-- .../OidcProviderConfigurationHttpMessageConverter.java | 4 ++-- .../http/converter/OidcUserInfoHttpMessageConverter.java | 4 ++-- .../authorization/JdbcOAuth2AuthorizationServiceTests.java | 4 ++-- .../client/JdbcRegisteredClientRepositoryTests.java | 2 +- .../OAuth2AuthorizationServerJackson2ModuleTests.java | 6 +++--- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationService.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationService.java index 86af06b06..daf9bf5da 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationService.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationService.java @@ -614,7 +614,7 @@ protected final ObjectMapper getObjectMapper() { private Map parseMap(String data) { try { - return this.objectMapper.readValue(data, new TypeReference>() { + return this.objectMapper.readValue(data, new TypeReference<>() { }); } catch (Exception ex) { diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepository.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepository.java index 7886d1b6c..112c238f0 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepository.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepository.java @@ -309,7 +309,7 @@ protected final ObjectMapper getObjectMapper() { private Map parseMap(String data) { try { - return this.objectMapper.readValue(data, new TypeReference>() { + return this.objectMapper.readValue(data, new TypeReference<>() { }); } catch (Exception ex) { diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2AuthorizationServerMetadataHttpMessageConverter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2AuthorizationServerMetadataHttpMessageConverter.java index 8219fecf0..a2db1d727 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2AuthorizationServerMetadataHttpMessageConverter.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2AuthorizationServerMetadataHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public class OAuth2AuthorizationServerMetadataHttpMessageConverter extends AbstractHttpMessageConverter { - private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { + private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { }; private final GenericHttpMessageConverter jsonMessageConverter = HttpMessageConverters diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2TokenIntrospectionHttpMessageConverter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2TokenIntrospectionHttpMessageConverter.java index 463106980..f64cd7de9 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2TokenIntrospectionHttpMessageConverter.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/http/converter/OAuth2TokenIntrospectionHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public class OAuth2TokenIntrospectionHttpMessageConverter extends AbstractHttpMessageConverter { - private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { + private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { }; private final GenericHttpMessageConverter jsonMessageConverter = HttpMessageConverters diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/jackson2/JsonNodeUtils.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/jackson2/JsonNodeUtils.java index f7b0bcae3..2dd12dbcf 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/jackson2/JsonNodeUtils.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/jackson2/JsonNodeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ */ abstract class JsonNodeUtils { - static final TypeReference> STRING_SET = new TypeReference>() { + static final TypeReference> STRING_SET = new TypeReference<>() { }; - static final TypeReference> STRING_OBJECT_MAP = new TypeReference>() { + static final TypeReference> STRING_OBJECT_MAP = new TypeReference<>() { }; static String findStringValue(JsonNode jsonNode, String fieldName) { diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcClientRegistrationHttpMessageConverter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcClientRegistrationHttpMessageConverter.java index 2a0ceff3b..ccb0056a8 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcClientRegistrationHttpMessageConverter.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcClientRegistrationHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ */ public class OidcClientRegistrationHttpMessageConverter extends AbstractHttpMessageConverter { - private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { + private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { }; private final GenericHttpMessageConverter jsonMessageConverter = HttpMessageConverters diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcProviderConfigurationHttpMessageConverter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcProviderConfigurationHttpMessageConverter.java index 37744fee8..a565802c2 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcProviderConfigurationHttpMessageConverter.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcProviderConfigurationHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public class OidcProviderConfigurationHttpMessageConverter extends AbstractHttpMessageConverter { - private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { + private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { }; private final GenericHttpMessageConverter jsonMessageConverter = HttpMessageConverters diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcUserInfoHttpMessageConverter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcUserInfoHttpMessageConverter.java index df967aca2..0b7b38cb3 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcUserInfoHttpMessageConverter.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/http/converter/OidcUserInfoHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ */ public class OidcUserInfoHttpMessageConverter extends AbstractHttpMessageConverter { - private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { + private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { }; private final GenericHttpMessageConverter jsonMessageConverter = HttpMessageConverters diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationServiceTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationServiceTests.java index ff9b69ab7..1624e876e 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationServiceTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationServiceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -756,7 +756,7 @@ public OAuth2Authorization mapRow(ResultSet rs, int rowNum) throws SQLException private Map parseMap(String data) { try { - return getObjectMapper().readValue(data, new TypeReference>() { + return getObjectMapper().readValue(data, new TypeReference<>() { }); } catch (Exception ex) { diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepositoryTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepositoryTests.java index 9ec94c4f5..451c0fcd2 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepositoryTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/JdbcRegisteredClientRepositoryTests.java @@ -417,7 +417,7 @@ public RegisteredClient mapRow(ResultSet rs, int rowNum) throws SQLException { private Map parseMap(String data) { try { - return this.objectMapper.readValue(data, new TypeReference>() { + return this.objectMapper.readValue(data, new TypeReference<>() { }); } catch (Exception ex) { diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/jackson2/OAuth2AuthorizationServerJackson2ModuleTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/jackson2/OAuth2AuthorizationServerJackson2ModuleTests.java index 34580d17e..03be1e4dd 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/jackson2/OAuth2AuthorizationServerJackson2ModuleTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/jackson2/OAuth2AuthorizationServerJackson2ModuleTests.java @@ -37,13 +37,13 @@ */ public class OAuth2AuthorizationServerJackson2ModuleTests { - private static final TypeReference> STRING_OBJECT_MAP = new TypeReference>() { + private static final TypeReference> STRING_OBJECT_MAP = new TypeReference<>() { }; - private static final TypeReference> STRING_SET = new TypeReference>() { + private static final TypeReference> STRING_SET = new TypeReference<>() { }; - private static final TypeReference STRING_ARRAY = new TypeReference() { + private static final TypeReference STRING_ARRAY = new TypeReference<>() { }; private ObjectMapper objectMapper;