Browse Source

Polish diamond usage

Tran Ngoc Nhan 10 months ago
parent
commit
ffed4ea1dc

+ 1 - 1
config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java

@@ -3696,7 +3696,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public HttpSecurity webAuthn(Customizer<WebAuthnConfigurer<HttpSecurity>> webAuthn) throws Exception {
 	public HttpSecurity webAuthn(Customizer<WebAuthnConfigurer<HttpSecurity>> webAuthn) throws Exception {
-		webAuthn.customize(getOrApply(new WebAuthnConfigurer<HttpSecurity>()));
+		webAuthn.customize(getOrApply(new WebAuthnConfigurer<>()));
 		return HttpSecurity.this;
 		return HttpSecurity.this;
 	}
 	}
 
 

+ 2 - 3
config/src/main/java/org/springframework/security/config/annotation/web/configurers/HttpBasicConfigurer.java

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may not use this file except in compliance with the License.
@@ -179,8 +179,7 @@ public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>>
 		allMatcher.setUseEquals(true);
 		allMatcher.setUseEquals(true);
 		RequestMatcher notHtmlMatcher = new NegatedRequestMatcher(
 		RequestMatcher notHtmlMatcher = new NegatedRequestMatcher(
 				new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.TEXT_HTML));
 				new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.TEXT_HTML));
-		RequestMatcher restNotHtmlMatcher = new AndRequestMatcher(
-				Arrays.<RequestMatcher>asList(notHtmlMatcher, restMatcher));
+		RequestMatcher restNotHtmlMatcher = new AndRequestMatcher(Arrays.asList(notHtmlMatcher, restMatcher));
 		RequestMatcher preferredMatcher = new OrRequestMatcher(
 		RequestMatcher preferredMatcher = new OrRequestMatcher(
 				Arrays.asList(X_REQUESTED_WITH, restNotHtmlMatcher, allMatcher));
 				Arrays.asList(X_REQUESTED_WITH, restNotHtmlMatcher, allMatcher));
 		registerDefaultEntryPoint(http, preferredMatcher);
 		registerDefaultEntryPoint(http, preferredMatcher);

+ 2 - 3
config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurer.java

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may not use this file except in compliance with the License.
@@ -326,8 +326,7 @@ public final class OAuth2ResourceServerConfigurer<H extends HttpSecurityBuilder<
 			allMatcher.setUseEquals(true);
 			allMatcher.setUseEquals(true);
 			RequestMatcher notHtmlMatcher = new NegatedRequestMatcher(
 			RequestMatcher notHtmlMatcher = new NegatedRequestMatcher(
 					new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.TEXT_HTML));
 					new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.TEXT_HTML));
-			RequestMatcher restNotHtmlMatcher = new AndRequestMatcher(
-					Arrays.<RequestMatcher>asList(notHtmlMatcher, restMatcher));
+			RequestMatcher restNotHtmlMatcher = new AndRequestMatcher(Arrays.asList(notHtmlMatcher, restMatcher));
 			RequestMatcher preferredMatcher = new OrRequestMatcher(
 			RequestMatcher preferredMatcher = new OrRequestMatcher(
 					Arrays.asList(this.requestMatcher, X_REQUESTED_WITH, restNotHtmlMatcher, allMatcher));
 					Arrays.asList(this.requestMatcher, X_REQUESTED_WITH, restNotHtmlMatcher, allMatcher));
 			exceptionHandling.defaultAuthenticationEntryPointFor(this.authenticationEntryPoint, preferredMatcher);
 			exceptionHandling.defaultAuthenticationEntryPointFor(this.authenticationEntryPoint, preferredMatcher);

+ 1 - 1
config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java

@@ -73,7 +73,7 @@ public class AuthenticationManagerFactoryBean implements FactoryBean<Authenticat
 				provider.setPasswordEncoder(passwordEncoder);
 				provider.setPasswordEncoder(passwordEncoder);
 			}
 			}
 			provider.afterPropertiesSet();
 			provider.afterPropertiesSet();
-			ProviderManager manager = new ProviderManager(Arrays.<AuthenticationProvider>asList(provider));
+			ProviderManager manager = new ProviderManager(Arrays.asList(provider));
 			if (this.observationRegistry.isNoop()) {
 			if (this.observationRegistry.isNoop()) {
 				return manager;
 				return manager;
 			}
 			}

+ 2 - 2
core/src/main/java/org/springframework/security/authentication/jaas/memory/InMemoryConfiguration.java

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2010-2016 the original author or authors.
+ * Copyright 2010-2024 the original author or authors.
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public class InMemoryConfiguration extends Configuration {
 	 * {@link #getAppConfigurationEntry(String)}. Can be <code>null</code>.
 	 * {@link #getAppConfigurationEntry(String)}. Can be <code>null</code>.
 	 */
 	 */
 	public InMemoryConfiguration(AppConfigurationEntry[] defaultConfiguration) {
 	public InMemoryConfiguration(AppConfigurationEntry[] defaultConfiguration) {
-		this(Collections.<String, AppConfigurationEntry[]>emptyMap(), defaultConfiguration);
+		this(Collections.emptyMap(), defaultConfiguration);
 	}
 	}
 
 
 	/**
 	/**

+ 2 - 2
core/src/main/java/org/springframework/security/core/parameters/DefaultSecurityParameterNameDiscoverer.java

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public class DefaultSecurityParameterNameDiscoverer extends PrioritizedParameter
 	 * instances.
 	 * instances.
 	 */
 	 */
 	public DefaultSecurityParameterNameDiscoverer() {
 	public DefaultSecurityParameterNameDiscoverer() {
-		this(Collections.<ParameterNameDiscoverer>emptyList());
+		this(Collections.emptyList());
 	}
 	}
 
 
 	/**
 	/**

+ 4 - 4
core/src/main/java/org/springframework/security/jackson2/CoreJackson2Module.java

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2024 the original author or authors.
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may not use this file except in compliance with the License.
@@ -60,11 +60,11 @@ public class CoreJackson2Module extends SimpleModule {
 		context.setMixInAnnotations(AnonymousAuthenticationToken.class, AnonymousAuthenticationTokenMixin.class);
 		context.setMixInAnnotations(AnonymousAuthenticationToken.class, AnonymousAuthenticationTokenMixin.class);
 		context.setMixInAnnotations(RememberMeAuthenticationToken.class, RememberMeAuthenticationTokenMixin.class);
 		context.setMixInAnnotations(RememberMeAuthenticationToken.class, RememberMeAuthenticationTokenMixin.class);
 		context.setMixInAnnotations(SimpleGrantedAuthority.class, SimpleGrantedAuthorityMixin.class);
 		context.setMixInAnnotations(SimpleGrantedAuthority.class, SimpleGrantedAuthorityMixin.class);
-		context.setMixInAnnotations(Collections.<Object>unmodifiableSet(Collections.emptySet()).getClass(),
+		context.setMixInAnnotations(Collections.unmodifiableSet(Collections.emptySet()).getClass(),
 				UnmodifiableSetMixin.class);
 				UnmodifiableSetMixin.class);
-		context.setMixInAnnotations(Collections.<Object>unmodifiableList(Collections.emptyList()).getClass(),
+		context.setMixInAnnotations(Collections.unmodifiableList(Collections.emptyList()).getClass(),
 				UnmodifiableListMixin.class);
 				UnmodifiableListMixin.class);
-		context.setMixInAnnotations(Collections.<Object, Object>unmodifiableMap(Collections.emptyMap()).getClass(),
+		context.setMixInAnnotations(Collections.unmodifiableMap(Collections.emptyMap()).getClass(),
 				UnmodifiableMapMixin.class);
 				UnmodifiableMapMixin.class);
 		context.setMixInAnnotations(User.class, UserMixin.class);
 		context.setMixInAnnotations(User.class, UserMixin.class);
 		context.setMixInAnnotations(UsernamePasswordAuthenticationToken.class,
 		context.setMixInAnnotations(UsernamePasswordAuthenticationToken.class,

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

@@ -34,7 +34,7 @@ abstract class JsonNodeUtils {
 	static final TypeReference<Set<String>> STRING_SET = new TypeReference<>() {
 	static final TypeReference<Set<String>> STRING_SET = new TypeReference<>() {
 	};
 	};
 
 
-	static final TypeReference<Map<String, Object>> STRING_OBJECT_MAP = new TypeReference<Map<String, Object>>() {
+	static final TypeReference<Map<String, Object>> STRING_OBJECT_MAP = new TypeReference<>() {
 	};
 	};
 
 
 	static String findStringValue(JsonNode jsonNode, String fieldName) {
 	static String findStringValue(JsonNode jsonNode, String fieldName) {

+ 1 - 1
web/src/main/java/org/springframework/security/web/webauthn/api/PublicKeyCredential.java

@@ -121,7 +121,7 @@ public final class PublicKeyCredential<R extends AuthenticatorResponse> {
 	 * @return the {@link PublicKeyCredentialBuilder}
 	 * @return the {@link PublicKeyCredentialBuilder}
 	 */
 	 */
 	public static <T extends AuthenticatorResponse> PublicKeyCredentialBuilder<T> builder() {
 	public static <T extends AuthenticatorResponse> PublicKeyCredentialBuilder<T> builder() {
-		return new PublicKeyCredentialBuilder<T>();
+		return new PublicKeyCredentialBuilder<>();
 	}
 	}
 
 
 	/**
 	/**