From c1e2baf527cfb4a66706897ca892c0f0c37110a4 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 23 Apr 2024 22:21:48 +0900 Subject: [PATCH] Polish --- .../languages/kotlin/spring-projects-in.adoc | 2 +- ...inApplicationListenerMethodAdapterTests.kt | 4 ++-- .../aot/agent/InstrumentedMethodTests.java | 16 ++++++------- .../core/metadata/TableMetaDataContext.java | 4 ++-- .../web/util/pattern/PathPattern.java | 2 +- .../client/RestTemplateObservationTests.java | 2 +- .../function/RouterFunctionDslTests.kt | 24 +++++++++---------- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc index 6efa48274a42..300c0089c897 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc @@ -166,7 +166,7 @@ public class SampleConfiguration { @Bean @NotNull public SampleBean sampleBean$demo_kotlin_internal_test() { - return new SampleBean(); + return new SampleBean(); } } ---- diff --git a/spring-context/src/test/kotlin/org/springframework/context/event/KotlinApplicationListenerMethodAdapterTests.kt b/spring-context/src/test/kotlin/org/springframework/context/event/KotlinApplicationListenerMethodAdapterTests.kt index 6141b354d513..3d19710946b4 100644 --- a/spring-context/src/test/kotlin/org/springframework/context/event/KotlinApplicationListenerMethodAdapterTests.kt +++ b/spring-context/src/test/kotlin/org/springframework/context/event/KotlinApplicationListenerMethodAdapterTests.kt @@ -64,9 +64,9 @@ class KotlinApplicationListenerMethodAdapterTests { private class StaticApplicationListenerMethodAdapter(method: Method, private val targetBean: Any) : ApplicationListenerMethodAdapter("unused", targetBean.javaClass, method) { public override fun getTargetBean(): Any { - return targetBean + return targetBean + } } - } @Suppress("RedundantSuspendModifier", "UNUSED_PARAMETER") private class SampleEvents { diff --git a/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java b/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java index 733c368c699a..032ac0465255 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java +++ b/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java @@ -124,7 +124,7 @@ public void setup() throws Exception { } @Test - void classGetConstructorShouldMatchInstrospectPublicConstructorsHint() { + void classGetConstructorShouldMatchIntrospectPublicConstructorsHint() { hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_CONSTRUCTORS); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETCONSTRUCTOR, this.stringGetConstructor); } @@ -148,7 +148,7 @@ void classGetConstructorShouldMatchInvokeDeclaredConstructorsHint() { } @Test - void classGetConstructorShouldMatchInstrospectConstructorHint() { + void classGetConstructorShouldMatchIntrospectConstructorHint() { hints.reflection().registerType(String.class,typeHint -> typeHint.withConstructor(Collections.emptyList(), ExecutableMode.INTROSPECT)); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETCONSTRUCTOR, this.stringGetConstructor); @@ -210,7 +210,7 @@ void classGetDeclaredConstructorShouldNotMatchIntrospectPublicConstructorsHint() } @Test - void classGetDeclaredConstructorShouldMatchInstrospectConstructorHint() { + void classGetDeclaredConstructorShouldMatchIntrospectConstructorHint() { hints.reflection().registerType(String.class, typeHint -> typeHint.withConstructor(TypeReference.listOf(byte[].class, byte.class), ExecutableMode.INTROSPECT)); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETDECLAREDCONSTRUCTOR, this.stringGetDeclaredConstructor); @@ -354,13 +354,13 @@ void classGetDeclaredMethodsShouldNotMatchMethodReflectionHint() throws Exceptio } @Test - void classGetMethodsShouldMatchInstrospectDeclaredMethodsHint() { + void classGetMethodsShouldMatchIntrospectDeclaredMethodsHint() { hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_DECLARED_METHODS); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods); } @Test - void classGetMethodsShouldMatchInstrospectPublicMethodsHint() { + void classGetMethodsShouldMatchIntrospectPublicMethodsHint() { hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods); } @@ -396,7 +396,7 @@ void classGetMethodsShouldNotMatchMethodReflectionHint() throws Exception { } @Test - void classGetMethodShouldMatchInstrospectPublicMethodsHint() { + void classGetMethodShouldMatchIntrospectPublicMethodsHint() { hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetToStringMethod); } @@ -434,13 +434,13 @@ void classGetMethodShouldMatchInvokeMethodHint() { } @Test - void classGetMethodShouldNotMatchInstrospectPublicMethodsHintWhenPrivate() { + void classGetMethodShouldNotMatchIntrospectPublicMethodsHintWhenPrivate() { hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS); assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetScaleMethod); } @Test - void classGetMethodShouldMatchInstrospectDeclaredMethodsHintWhenPrivate() { + void classGetMethodShouldMatchIntrospectDeclaredMethodsHintWhenPrivate() { hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_DECLARED_METHODS); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetScaleMethod); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java index 9ae79a434936..bf69f2f7c4af 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java @@ -432,12 +432,12 @@ private static final class QuoteHandler { private final boolean quoting; - public QuoteHandler(@Nullable String identifierQuoteString) { + QuoteHandler(@Nullable String identifierQuoteString) { this.identifierQuoteString = identifierQuoteString; this.quoting = StringUtils.hasText(identifierQuoteString); } - public void appendTo(StringBuilder stringBuilder, @Nullable String item) { + void appendTo(StringBuilder stringBuilder, @Nullable String item) { if (this.quoting) { stringBuilder.append(this.identifierQuoteString) .append(item).append(this.identifierQuoteString); diff --git a/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java b/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java index 3067bcefa693..c87a538cbebe 100644 --- a/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java +++ b/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java @@ -44,7 +44,7 @@ *
  • {@code **} matches zero or more path segments until the end of the path
  • *
  • {spring} matches a path segment and captures it as a variable named "spring"
  • *
  • {spring:[a-z]+} matches the regexp {@code [a-z]+} against a path segment - * and captures it a path variable named "spring"
  • + * and captures it as a path variable named "spring" *
  • {*spring} matches zero or more path segments until the end of the path * and captures it as a variable named "spring"
  • * diff --git a/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java b/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java index 47664f880914..042477227f4a 100644 --- a/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java @@ -238,7 +238,7 @@ static class ObservationErrorHandler implements ResponseErrorHandler { @Nullable Observation currentObservation; - public ObservationErrorHandler(TestObservationRegistry observationRegistry) { + ObservationErrorHandler(TestObservationRegistry observationRegistry) { this.observationRegistry = observationRegistry; } diff --git a/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/function/RouterFunctionDslTests.kt b/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/function/RouterFunctionDslTests.kt index 909d3e38bf33..960dde0f467b 100644 --- a/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/function/RouterFunctionDslTests.kt +++ b/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/function/RouterFunctionDslTests.kt @@ -38,7 +38,7 @@ class RouterFunctionDslTests { val servletRequest = PathPatternsTestUtils.initRequest("GET", "", true) servletRequest.addHeader("bar", "bar") val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test @@ -46,7 +46,7 @@ class RouterFunctionDslTests { val servletRequest = PathPatternsTestUtils.initRequest("GET", "/content", true) servletRequest.addHeader(ACCEPT, APPLICATION_ATOM_XML_VALUE) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test @@ -54,7 +54,7 @@ class RouterFunctionDslTests { val servletRequest = PathPatternsTestUtils.initRequest("POST", "/api/foo/", true) servletRequest.addHeader(ACCEPT, APPLICATION_JSON_VALUE) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test @@ -63,7 +63,7 @@ class RouterFunctionDslTests { servletRequest.addHeader(ACCEPT, APPLICATION_JSON_VALUE) servletRequest.addHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test @@ -71,49 +71,49 @@ class RouterFunctionDslTests { val servletRequest = PathPatternsTestUtils.initRequest("GET", "/content", true) servletRequest.addHeader(CONTENT_TYPE, APPLICATION_OCTET_STREAM_VALUE) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test fun method() { val servletRequest = PathPatternsTestUtils.initRequest("PATCH", "/", true) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test fun path() { val servletRequest = PathPatternsTestUtils.initRequest("GET", "/baz", true) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test fun pathExtension() { val servletRequest = PathPatternsTestUtils.initRequest("GET", "/test.properties", true) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test fun resource() { val servletRequest = PathPatternsTestUtils.initRequest("GET","/response2.txt", true) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test fun resources() { val servletRequest = PathPatternsTestUtils.initRequest("GET", "/resources/response.txt", true) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test fun resourcesLookupFunction() { val servletRequest = PathPatternsTestUtils.initRequest("GET", "/response.txt", true) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isTrue() + assertThat(sampleRouter().route(request)).isPresent() } @Test @@ -123,7 +123,7 @@ class RouterFunctionDslTests { servletRequest.addHeader(ACCEPT, APPLICATION_PDF_VALUE) servletRequest.addHeader(CONTENT_TYPE, APPLICATION_PDF_VALUE) val request = DefaultServerRequest(servletRequest, emptyList()) - assertThat(sampleRouter().route(request).isPresent).isFalse() + assertThat(sampleRouter().route(request)).isNotPresent() } @Test