From 6d86b23fbe4ef8ef97579aa7868f180c2bfecbc3 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sun, 29 Dec 2024 01:11:53 +0900 Subject: [PATCH] Apply Checkstyle MethodParamPadCheck module This commit also fixes its violations. Closes gh-34173 --- .../context/event/ApplicationListenerMethodAdapterTests.java | 4 ++-- .../context/support/ConversionServiceFactoryBeanTests.java | 2 +- .../springframework/aot/generate/GeneratedClassesTests.java | 4 ++-- .../messaging/handler/CompositeMessageCondition.java | 2 +- .../springframework/web/bind/ServletRequestDataBinder.java | 2 +- ...TemplateServletAnnotationControllerHandlerMethodTests.java | 2 +- src/checkstyle/checkstyle.xml | 1 + 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/spring-context/src/test/java/org/springframework/context/event/ApplicationListenerMethodAdapterTests.java b/spring-context/src/test/java/org/springframework/context/event/ApplicationListenerMethodAdapterTests.java index fbafc8e0f207..936a4df082e0 100644 --- a/spring-context/src/test/java/org/springframework/context/event/ApplicationListenerMethodAdapterTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/ApplicationListenerMethodAdapterTests.java @@ -213,8 +213,8 @@ void invokeListenerWithGenericPayload() { @Test void invokeListenerWithWrongGenericPayload() { - Method method = ReflectionUtils.findMethod - (SampleEvents.class, "handleGenericStringPayload", EntityWrapper.class); + Method method = ReflectionUtils.findMethod( + SampleEvents.class, "handleGenericStringPayload", EntityWrapper.class); EntityWrapper payload = new EntityWrapper<>(123); invokeListener(method, new PayloadApplicationEvent<>(this, payload)); verify(this.sampleEvents, times(0)).handleGenericStringPayload(any()); diff --git a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java index 90e3ccba6040..fc737bbfa317 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java @@ -67,7 +67,7 @@ public Foo convert(String source) { converters.add(new ConverterFactory() { @Override public Converter getConverter(Class targetType) { - return new Converter<> () { + return new Converter<>() { @SuppressWarnings("unchecked") @Override public T convert(String source) { diff --git a/spring-core/src/test/java/org/springframework/aot/generate/GeneratedClassesTests.java b/spring-core/src/test/java/org/springframework/aot/generate/GeneratedClassesTests.java index f13045242c5d..7584153141a6 100644 --- a/spring-core/src/test/java/org/springframework/aot/generate/GeneratedClassesTests.java +++ b/spring-core/src/test/java/org/springframework/aot/generate/GeneratedClassesTests.java @@ -148,8 +148,8 @@ void getOrAddForFeatureComponentWhenHasFeatureNamePrefix() { "one", TestComponent.class, emptyTypeCustomizer); GeneratedClass generatedClass2 = this.generatedClasses.getOrAddForFeatureComponent( "one", TestComponent.class, emptyTypeCustomizer); - GeneratedClass generatedClass3 = prefixed.getOrAddForFeatureComponent - ("one", TestComponent.class, emptyTypeCustomizer); + GeneratedClass generatedClass3 = prefixed.getOrAddForFeatureComponent( + "one", TestComponent.class, emptyTypeCustomizer); GeneratedClass generatedClass4 = prefixed.getOrAddForFeatureComponent( "one", TestComponent.class, emptyTypeCustomizer); assertThat(generatedClass1).isSameAs(generatedClass2).isNotSameAs(generatedClass3); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/CompositeMessageCondition.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/CompositeMessageCondition.java index d9c908fb9284..f9785b9096a2 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/CompositeMessageCondition.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/CompositeMessageCondition.java @@ -98,7 +98,7 @@ public int compareTo(CompositeMessageCondition other, Message message) { checkCompatible(other); List> otherConditions = other.getMessageConditions(); for (int i = 0; i < this.messageConditions.size(); i++) { - int result = compare (this.messageConditions.get(i), otherConditions.get(i), message); + int result = compare(this.messageConditions.get(i), otherConditions.get(i), message); if (result != 0) { return result; } diff --git a/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java b/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java index 6add6a2dbb96..95ff7db1a332 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java +++ b/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java @@ -244,7 +244,7 @@ public final Object resolveValue(String name, Class paramType) { @Nullable protected Object getRequestParameter(String name, Class type) { Object value = this.request.getParameterValues(name); - if (value == null && !name.endsWith ("[]") && + if (value == null && !name.endsWith("[]") && (List.class.isAssignableFrom(type) || type.isArray())) { value = this.request.getParameterValues(name + "[]"); } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriTemplateServletAnnotationControllerHandlerMethodTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriTemplateServletAnnotationControllerHandlerMethodTests.java index 005c0edbc1e8..d8398fa279f9 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriTemplateServletAnnotationControllerHandlerMethodTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriTemplateServletAnnotationControllerHandlerMethodTests.java @@ -665,7 +665,7 @@ public ModelValidatingViewResolver(Map attrsToValidate) { @Override public View resolveViewName(final String viewName, Locale locale) { - return new AbstractView () { + return new AbstractView() { @Override public String getContentType() { return null; diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 49a96b0fc0bf..2701517a0d33 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -191,6 +191,7 @@ +