Skip to content

Commit 31f8cae

Browse files
ngocnhan-tran1996jzheaux
authored andcommitted
Polish diamond operator usage
1 parent f3e95c8 commit 31f8cae

File tree

24 files changed

+42
-44
lines changed

24 files changed

+42
-44
lines changed

buildSrc/src/main/java/org/springframework/security/convention/versions/VerifyDependenciesVersionsPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeAuthenticationProviderBeanManagerConfigurer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -95,7 +95,7 @@ private <T> List<BeanWithName<T>> getBeansWithName(Class<T> type) {
9595
.getBeanNamesForType(type);
9696
for (String beanName : beanNames) {
9797
T bean = InitializeAuthenticationProviderBeanManagerConfigurer.this.context.getBean(beanName, type);
98-
beanWithNames.add(new BeanWithName<T>(bean, beanName));
98+
beanWithNames.add(new BeanWithName<>(bean, beanName));
9999
}
100100
return beanWithNames;
101101
}

config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeUserDetailsBeanManagerConfigurer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private <T> List<BeanWithName<T>> getBeansWithName(Class<T> type) {
134134
String[] beanNames = InitializeUserDetailsBeanManagerConfigurer.this.context.getBeanNamesForType(type);
135135
for (String beanName : beanNames) {
136136
T bean = InitializeUserDetailsBeanManagerConfigurer.this.context.getBean(beanName, type);
137-
beanWithNames.add(new BeanWithName<T>(bean, beanName));
137+
beanWithNames.add(new BeanWithName<>(bean, beanName));
138138
}
139139
return beanWithNames;
140140
}

config/src/main/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public class GlobalMethodSecurityConfiguration implements ImportAware, SmartInit
9797

9898
private static final Log logger = LogFactory.getLog(GlobalMethodSecurityConfiguration.class);
9999

100-
private ObjectPostProcessor<Object> objectPostProcessor = new ObjectPostProcessor<Object>() {
100+
private ObjectPostProcessor<Object> objectPostProcessor = new ObjectPostProcessor<>() {
101101

102102
@Override
103103
public <T> T postProcess(T object) {

core/src/main/java/org/springframework/security/jackson2/UserDeserializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2018 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@
4242
*/
4343
class UserDeserializer extends JsonDeserializer<User> {
4444

45-
private static final TypeReference<Set<SimpleGrantedAuthority>> SIMPLE_GRANTED_AUTHORITY_SET = new TypeReference<Set<SimpleGrantedAuthority>>() {
45+
private static final TypeReference<Set<SimpleGrantedAuthority>> SIMPLE_GRANTED_AUTHORITY_SET = new TypeReference<>() {
4646
};
4747

4848
/**

core/src/main/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenDeserializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2022 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,10 +50,10 @@
5050
*/
5151
class UsernamePasswordAuthenticationTokenDeserializer extends JsonDeserializer<UsernamePasswordAuthenticationToken> {
5252

53-
private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<List<GrantedAuthority>>() {
53+
private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<>() {
5454
};
5555

56-
private static final TypeReference<Object> OBJECT = new TypeReference<Object>() {
56+
private static final TypeReference<Object> OBJECT = new TypeReference<>() {
5757
};
5858

5959
/**

messaging/src/main/java/org/springframework/security/messaging/util/matcher/MessageMatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ public interface MessageMatcher<T> {
2929
/**
3030
* Matches every {@link Message}
3131
*/
32-
MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<Object>() {
32+
MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<>() {
3333

3434
@Override
3535
public boolean matches(Message<?> message) {

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/jackson2/JsonNodeUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
3131
*/
3232
abstract class JsonNodeUtils {
3333

34-
static final TypeReference<Set<String>> STRING_SET = new TypeReference<Set<String>>() {
34+
static final TypeReference<Set<String>> STRING_SET = new TypeReference<>() {
3535
};
3636

3737
static final TypeReference<Map<String, Object>> STRING_OBJECT_MAP = new TypeReference<Map<String, Object>>() {

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/ReactiveOidcIdTokenDecoderFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ public final class ReactiveOidcIdTokenDecoderFactory implements ReactiveJwtDecod
7070

7171
private static final Map<JwsAlgorithm, String> JCA_ALGORITHM_MAPPINGS;
7272
static {
73-
Map<JwsAlgorithm, String> mappings = new HashMap<JwsAlgorithm, String>();
73+
Map<JwsAlgorithm, String> mappings = new HashMap<>();
7474
mappings.put(MacAlgorithm.HS256, "HmacSHA256");
7575
mappings.put(MacAlgorithm.HS384, "HmacSHA384");
7676
mappings.put(MacAlgorithm.HS512, "HmacSHA512");

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ public final class ClientRegistrations {
6666
rest.setRequestFactory(requestFactory);
6767
}
6868

69-
private static final ParameterizedTypeReference<Map<String, Object>> typeReference = new ParameterizedTypeReference<Map<String, Object>>() {
69+
private static final ParameterizedTypeReference<Map<String, Object>> typeReference = new ParameterizedTypeReference<>() {
7070
};
7171

7272
private ClientRegistrations() {

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class DefaultOAuth2UserService implements OAuth2UserService<OAuth2UserReq
7171

7272
private static final String INVALID_USER_INFO_RESPONSE_ERROR_CODE = "invalid_user_info_response";
7373

74-
private static final ParameterizedTypeReference<Map<String, Object>> PARAMETERIZED_RESPONSE_TYPE = new ParameterizedTypeReference<Map<String, Object>>() {
74+
private static final ParameterizedTypeReference<Map<String, Object>> PARAMETERIZED_RESPONSE_TYPE = new ParameterizedTypeReference<>() {
7575
};
7676

7777
private Converter<OAuth2UserRequest, RequestEntity<?>> requestEntityConverter = new OAuth2UserRequestEntityConverter();

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/DefaultReactiveOAuth2UserService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ public class DefaultReactiveOAuth2UserService implements ReactiveOAuth2UserServi
7373

7474
private static final String MISSING_USER_NAME_ATTRIBUTE_ERROR_CODE = "missing_user_name_attribute";
7575

76-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
76+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
7777
};
7878

79-
private static final ParameterizedTypeReference<Map<String, String>> STRING_STRING_MAP = new ParameterizedTypeReference<Map<String, String>>() {
79+
private static final ParameterizedTypeReference<Map<String, String>> STRING_STRING_MAP = new ParameterizedTypeReference<>() {
8080
};
8181

8282
private Converter<OAuth2UserRequest, Converter<Map<String, Object>, Map<String, Object>>> attributesConverter = (

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/http/converter/OAuth2AccessTokenResponseHttpMessageConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ public class OAuth2AccessTokenResponseHttpMessageConverter
4949

5050
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
5151

52-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
52+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
5353
};
5454

5555
private GenericHttpMessageConverter<Object> jsonMessageConverter = HttpMessageConverters.getJsonMessageConverter();

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/http/converter/OAuth2ErrorHttpMessageConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ public class OAuth2ErrorHttpMessageConverter extends AbstractHttpMessageConverte
4949

5050
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
5151

52-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
52+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
5353
};
5454

5555
private GenericHttpMessageConverter<Object> jsonMessageConverter = HttpMessageConverters.getJsonMessageConverter();

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/web/reactive/function/OAuth2AccessTokenResponseBodyExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ class OAuth2AccessTokenResponseBodyExtractor
5353

5454
private static final String INVALID_TOKEN_RESPONSE_ERROR_CODE = "invalid_token_response";
5555

56-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
56+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
5757
};
5858

5959
OAuth2AccessTokenResponseBodyExtractor() {

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ final class JwtDecoderProviderConfigurationUtils {
7575
rest.setRequestFactory(requestFactory);
7676
}
7777

78-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
78+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
7979
};
8080

8181
private JwtDecoderProviderConfigurationUtils() {

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/ReactiveJwtDecoderProviderConfigurationUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ final class ReactiveJwtDecoderProviderConfigurationUtils {
4949

5050
private static final String OAUTH_METADATA_PATH = "/.well-known/oauth-authorization-server";
5151

52-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
52+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
5353
};
5454

5555
static <C extends SecurityContext> Mono<ConfigurableJWTProcessor<C>> addJWSAlgorithms(

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringOpaqueTokenIntrospector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class SpringOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
6262

6363
private static final String AUTHORITY_PREFIX = "SCOPE_";
6464

65-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
65+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
6666
};
6767

6868
private final Log logger = LogFactory.getLog(getClass());

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringReactiveOpaqueTokenIntrospector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class SpringReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke
5858

5959
private static final String AUTHORITY_PREFIX = "SCOPE_";
6060

61-
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
61+
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
6262
};
6363

6464
private final URI introspectionUri;

rsocket/src/main/java/org/springframework/security/rsocket/util/matcher/PayloadExchangeMatcher.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 the original author or authors.
2+
* Copyright 2019-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -81,8 +81,7 @@ public static Mono<MatchResult> match() {
8181
* @return
8282
*/
8383
public static Mono<MatchResult> match(Map<String, ? extends Object> variables) {
84-
MatchResult result = new MatchResult(true,
85-
(variables != null) ? new HashMap<String, Object>(variables) : null);
84+
MatchResult result = new MatchResult(true, (variables != null) ? new HashMap<>(variables) : null);
8685
return Mono.just(result);
8786
}
8887

web/src/main/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPoint.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2+
* Copyright 2004-2024 Acegi Technology Pty Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -138,7 +138,6 @@ public void commence(HttpServletRequest request, HttpServletResponse response,
138138
logger.debug(LogMessage.format("Server side forward to: %s", loginForm));
139139
RequestDispatcher dispatcher = request.getRequestDispatcher(loginForm);
140140
dispatcher.forward(request, response);
141-
return;
142141
}
143142

144143
protected String buildRedirectUrlToLoginPage(HttpServletRequest request, HttpServletResponse response,

web/src/main/java/org/springframework/security/web/authentication/preauth/websphere/DefaultWASUsernameAndGroupsExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -129,7 +129,7 @@ private static List<String> getWebSphereGroups(final String securityName) {
129129
final Collection<String> groups = (Collection<String>) invokeMethod(getGroupsForUserMethod(), userReg,
130130
new Object[] { securityName });
131131
logger.debug(LogMessage.format("Groups for user %s: %s", securityName, groups));
132-
return new ArrayList<String>(groups);
132+
return new ArrayList<>(groups);
133133
}
134134
catch (Exception ex) {
135135
logger.error("Exception occured while looking up groups for user", ex);

web/src/main/java/org/springframework/security/web/firewall/StrictHttpFirewall.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ public Enumeration<String> getHeaders(String name) {
737737
validateAllowedHeaderName(name);
738738
}
739739
Enumeration<String> headers = super.getHeaders(name);
740-
return new Enumeration<String>() {
740+
return new Enumeration<>() {
741741

742742
@Override
743743
public boolean hasMoreElements() {
@@ -757,7 +757,7 @@ public String nextElement() {
757757
@Override
758758
public Enumeration<String> getHeaderNames() {
759759
Enumeration<String> names = super.getHeaderNames();
760-
return new Enumeration<String>() {
760+
return new Enumeration<>() {
761761

762762
@Override
763763
public boolean hasMoreElements() {
@@ -803,7 +803,7 @@ public Map<String, String[]> getParameterMap() {
803803
@Override
804804
public Enumeration<String> getParameterNames() {
805805
Enumeration<String> paramaterNames = super.getParameterNames();
806-
return new Enumeration<String>() {
806+
return new Enumeration<>() {
807807

808808
@Override
809809
public boolean hasMoreElements() {

web/src/main/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenDeserializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2018 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@
4646
*/
4747
class PreAuthenticatedAuthenticationTokenDeserializer extends JsonDeserializer<PreAuthenticatedAuthenticationToken> {
4848

49-
private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<List<GrantedAuthority>>() {
49+
private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<>() {
5050
};
5151

5252
/**

0 commit comments

Comments
 (0)