From 7474af4f099af43d72312e40b3fff5679ce0499c Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Thu, 28 Dec 2023 10:41:06 +0800 Subject: [PATCH 1/2] Cleanup kotlin sources 1. remove unused import 2. remove redundant semicolon 3. remove redundant empty constructor and SAM-constructor 4. remove unnecessary type argument 5. adjust indent See gh-31913 --- ...oProxyInterceptorKotlinIntegrationTests.kt | 4 +- .../aop/support/AopUtilsKotlinTests.kt | 2 +- .../beans/KotlinBeanUtilsBenchmark.kt | 24 +++++----- .../jdbc/core/JdbcOperationsExtensions.kt | 6 +-- .../function/server/RouterFunctionDsl.kt | 48 +++++++++---------- .../server/CoRouterFunctionDslTests.kt | 4 +- .../function/server/RouterFunctionDslTests.kt | 5 +- .../InvocableHandlerMethodKotlinTests.kt | 2 +- .../annotation/CoroutinesIntegrationTests.kt | 20 ++++---- .../MessageWriterResultHandlerKotlinTests.kt | 1 - 10 files changed, 57 insertions(+), 59 deletions(-) diff --git a/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt b/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt index c8f1bdea2643..e0b4f9c44a5b 100644 --- a/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt +++ b/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt @@ -94,12 +94,12 @@ class AspectJAutoProxyInterceptorKotlinIntegrationTests( open class Echo { open fun echo(value: String): String { - return value; + return value } open suspend fun suspendingEcho(value: String): String { delay(1) - return value; + return value } } diff --git a/spring-aop/src/test/kotlin/org/springframework/aop/support/AopUtilsKotlinTests.kt b/spring-aop/src/test/kotlin/org/springframework/aop/support/AopUtilsKotlinTests.kt index 37b302cd529c..a6806f90d11f 100644 --- a/spring-aop/src/test/kotlin/org/springframework/aop/support/AopUtilsKotlinTests.kt +++ b/spring-aop/src/test/kotlin/org/springframework/aop/support/AopUtilsKotlinTests.kt @@ -46,7 +46,7 @@ class AopUtilsKotlinTests { @Suppress("unused") suspend fun suspendingFunction(value: String): String { delay(1) - return value; + return value } } diff --git a/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt b/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt index 9bbdd9711df0..6c50b34cfe34 100644 --- a/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt +++ b/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt @@ -16,7 +16,7 @@ package org.springframework.beans -import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeUnit import org.openjdk.jmh.annotations.Benchmark import org.openjdk.jmh.annotations.BenchmarkMode @@ -30,22 +30,22 @@ import org.openjdk.jmh.annotations.State @OutputTimeUnit(TimeUnit.NANOSECONDS) open class KotlinBeanUtilsBenchmark { - private val noArgConstructor = TestClass1::class.java.getDeclaredConstructor() - private val constructor = TestClass2::class.java.getDeclaredConstructor(Int::class.java, String::class.java) + private val noArgConstructor = TestClass1::class.java.getDeclaredConstructor() + private val constructor = TestClass2::class.java.getDeclaredConstructor(Int::class.java, String::class.java) - @Benchmark - fun emptyConstructor(): Any { + @Benchmark + fun emptyConstructor(): Any { return BeanUtils.instantiateClass(noArgConstructor) - } + } - @Benchmark - fun nonEmptyConstructor(): Any { + @Benchmark + fun nonEmptyConstructor(): Any { return BeanUtils.instantiateClass(constructor, 1, "str") - } + } - class TestClass1() + class TestClass1 - @Suppress("UNUSED_PARAMETER") - class TestClass2(int: Int, string: String) + @Suppress("UNUSED_PARAMETER") + class TestClass2(int: Int, string: String) } diff --git a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt index f6dbe709a50c..adca16a2587f 100644 --- a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt +++ b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt @@ -35,7 +35,7 @@ inline fun JdbcOperations.queryForObject(sql: String): T = * @since 5.0 */ inline fun JdbcOperations.queryForObject(sql: String, vararg args: Any, crossinline function: (ResultSet, Int) -> T): T = - queryForObject(sql, RowMapper { resultSet, i -> function(resultSet, i) }, *args) as T + queryForObject(sql, { resultSet, i -> function(resultSet, i) }, *args) as T /** * Extension for [JdbcOperations.queryForObject] providing a @@ -113,7 +113,7 @@ inline fun JdbcOperations.query(sql: String, vararg args: Any, * @since 5.0 */ fun JdbcOperations.query(sql: String, vararg args: Any, function: (ResultSet) -> Unit): Unit = - query(sql, RowCallbackHandler { function(it) }, *args) + query(sql, { function(it) }, *args) /** * Extensions for [JdbcOperations.query] providing a RowMapper-like function variant: @@ -123,4 +123,4 @@ fun JdbcOperations.query(sql: String, vararg args: Any, function: (ResultSet) -> * @since 5.0 */ fun JdbcOperations.query(sql: String, vararg args: Any, function: (ResultSet, Int) -> T): List = - query(sql, RowMapper { rs, i -> function(rs, i) }, *args) + query(sql, { rs, i -> function(rs, i) }, *args) diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt index ae8785820301..605e2908f222 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt @@ -174,7 +174,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.3 */ fun GET(predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.GET(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.GET(predicate, { f(it).cast(ServerResponse::class.java) }) } /** @@ -185,7 +185,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.2 */ fun GET(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.GET(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.GET(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -219,7 +219,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.3 */ fun HEAD(predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.HEAD(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.HEAD(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -230,7 +230,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.2 */ fun HEAD(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.HEAD(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.HEAD(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -264,7 +264,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.3 */ fun POST(predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.POST(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.POST(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -275,7 +275,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.2 */ fun POST(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.POST(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.POST(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -309,7 +309,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.3 */ fun PUT(predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.PUT(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.PUT(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -320,7 +320,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.2 */ fun PUT(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.PUT(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.PUT(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -354,7 +354,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.3 */ fun PATCH(predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.PATCH(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.PATCH(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -365,7 +365,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.2 */ fun PATCH(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.PATCH(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.PATCH(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -401,7 +401,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.3 */ fun DELETE(predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.DELETE(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.DELETE(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -412,7 +412,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.2 */ fun DELETE(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.DELETE(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.DELETE(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -448,7 +448,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.3 */ fun OPTIONS(predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.OPTIONS(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.OPTIONS(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -459,7 +459,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @since 5.2 */ fun OPTIONS(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono) { - builder.OPTIONS(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) + builder.OPTIONS(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) }) } /** @@ -476,7 +476,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun accept(mediaType: MediaType, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.accept(mediaType), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.accept(mediaType), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -493,7 +493,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun contentType(mediaTypes: MediaType, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.contentType(mediaTypes), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.contentType(mediaTypes), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -510,7 +510,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun headers(headersPredicate: (ServerRequest.Headers) -> Boolean, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.headers(headersPredicate), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.headers(headersPredicate), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -526,7 +526,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun method(httpMethod: HttpMethod, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.method(httpMethod), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.method(httpMethod), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -541,7 +541,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun path(pattern: String, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.path(pattern), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.path(pattern), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -555,7 +555,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun pathExtension(extension: String, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.pathExtension(extension), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.pathExtension(extension), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -570,7 +570,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun pathExtension(predicate: (String) -> Boolean, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.pathExtension(predicate), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.pathExtension(predicate), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -586,7 +586,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ fun queryParam(name: String, predicate: (String) -> Boolean, f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.queryParam(name, predicate), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.queryParam(name, predicate), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -605,7 +605,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ operator fun RequestPredicate.invoke(f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(this, HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(this, HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** @@ -614,7 +614,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs * @see RouterFunctions.route */ operator fun String.invoke(f: (ServerRequest) -> Mono) { - builder.add(RouterFunctions.route(RequestPredicates.path(this), HandlerFunction { f(it).cast(ServerResponse::class.java) })) + builder.add(RouterFunctions.route(RequestPredicates.path(this), HandlerFunction { f(it).cast(ServerResponse::class.java) })) } /** diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/CoRouterFunctionDslTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/CoRouterFunctionDslTests.kt index e0a75566b72d..88f6436a650c 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/CoRouterFunctionDslTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/CoRouterFunctionDslTests.kt @@ -281,8 +281,8 @@ class CoRouterFunctionDslTests { listOf(mapOf("foo" to "bar"), mapOf("foo" to "n1")), listOf(mapOf("baz" to "qux"), mapOf("foo" to "n1")), listOf(mapOf("foo" to "n3"), mapOf("foo" to "n2"), mapOf("foo" to "n1")) - ); - assertThat(visitor.visitCount()).isEqualTo(7); + ) + assertThat(visitor.visitCount()).isEqualTo(7) } private fun sampleRouter() = coRouter { diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt index 4edd902ca9df..2b12c40fd32b 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt @@ -27,7 +27,6 @@ import org.springframework.http.MediaType.* import org.springframework.web.reactive.function.server.support.ServerRequestWrapper import org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest.* import org.springframework.web.testfixture.server.MockServerWebExchange -import org.springframework.web.reactive.function.server.AttributesTestVisitor import reactor.core.publisher.Mono import reactor.test.StepVerifier import java.security.Principal @@ -167,8 +166,8 @@ class RouterFunctionDslTests { listOf(mapOf("foo" to "bar"), mapOf("foo" to "n1")), listOf(mapOf("baz" to "qux"), mapOf("foo" to "n1")), listOf(mapOf("foo" to "n3"), mapOf("foo" to "n2"), mapOf("foo" to "n1")) - ); - assertThat(visitor.visitCount()).isEqualTo(7); + ) + assertThat(visitor.visitCount()).isEqualTo(7) } @Test diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/InvocableHandlerMethodKotlinTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/InvocableHandlerMethodKotlinTests.kt index 61daeb514006..85c30a341592 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/InvocableHandlerMethodKotlinTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/InvocableHandlerMethodKotlinTests.kt @@ -52,7 +52,7 @@ class InvocableHandlerMethodKotlinTests { private var exchange = MockServerWebExchange.from(get("http://localhost:8080/path")) - private val resolvers = mutableListOf(ContinuationHandlerMethodArgumentResolver(), + private val resolvers = mutableListOf(ContinuationHandlerMethodArgumentResolver(), RequestParamMethodArgumentResolver(null, ReactiveAdapterRegistry.getSharedInstance(), false)) @Test diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt index 4252423c5130..57fe2c6aae38 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/CoroutinesIntegrationTests.kt @@ -55,7 +55,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { fun `Suspending handler method`(httpServer: HttpServer) { startServer(httpServer) - val entity = performGet("/suspend", HttpHeaders.EMPTY, String::class.java) + val entity = performGet("/suspend", HttpHeaders.EMPTY, String::class.java) assertThat(entity.statusCode).isEqualTo(HttpStatus.OK) assertThat(entity.body).isEqualTo("foo") } @@ -64,7 +64,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { fun `Handler method returning Deferred`(httpServer: HttpServer) { startServer(httpServer) - val entity = performGet("/deferred", HttpHeaders.EMPTY, String::class.java) + val entity = performGet("/deferred", HttpHeaders.EMPTY, String::class.java) assertThat(entity.statusCode).isEqualTo(HttpStatus.OK) assertThat(entity.body).isEqualTo("foo") } @@ -73,7 +73,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { fun `Suspending ResponseEntity handler method`(httpServer: HttpServer) { startServer(httpServer) - val entity = performGet("/suspend-response-entity", HttpHeaders.EMPTY, String::class.java) + val entity = performGet("/suspend-response-entity", HttpHeaders.EMPTY, String::class.java) assertThat(entity.statusCode).isEqualTo(HttpStatus.OK) assertThat(entity.body).isEqualTo("{\"value\":\"foo\"}") } @@ -82,7 +82,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { fun `Handler method returning Flow`(httpServer: HttpServer) { startServer(httpServer) - val entity = performGet("/flow", HttpHeaders.EMPTY, String::class.java) + val entity = performGet("/flow", HttpHeaders.EMPTY, String::class.java) assertThat(entity.statusCode).isEqualTo(HttpStatus.OK) assertThat(entity.body).isEqualTo("foobar") } @@ -91,7 +91,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { fun `Suspending handler method returning Flow`(httpServer: HttpServer) { startServer(httpServer) - val entity = performGet("/suspending-flow", HttpHeaders.EMPTY, String::class.java) + val entity = performGet("/suspending-flow", HttpHeaders.EMPTY, String::class.java) assertThat(entity.statusCode).isEqualTo(HttpStatus.OK) assertThat(entity.body).isEqualTo("foobar") } @@ -101,7 +101,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { startServer(httpServer) assertThatExceptionOfType(HttpServerErrorException.InternalServerError::class.java).isThrownBy { - performGet("/error", HttpHeaders.EMPTY, String::class.java) + performGet("/error", HttpHeaders.EMPTY, String::class.java) } } @@ -110,7 +110,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { startServer(httpServer) assertThatExceptionOfType(HttpServerErrorException.InternalServerError::class.java).isThrownBy { - performGet("/flow-error", HttpHeaders.EMPTY, String::class.java) + performGet("/flow-error", HttpHeaders.EMPTY, String::class.java) } } @@ -120,7 +120,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { startServer(httpServer) - val entity = performGet("/entity-flux", HttpHeaders.EMPTY, String::class.java) + val entity = performGet("/entity-flux", HttpHeaders.EMPTY, String::class.java) assertThat(entity.statusCode).isEqualTo(HttpStatus.OK) assertThat(entity.body).isEqualTo("foobar") } @@ -129,7 +129,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { fun `Suspending handler method returning ResponseEntity of Flow`(httpServer: HttpServer) { startServer(httpServer) - val entity = performGet("/entity-flow", HttpHeaders.EMPTY, String::class.java) + val entity = performGet("/entity-flow", HttpHeaders.EMPTY, String::class.java) assertThat(entity.statusCode).isEqualTo(HttpStatus.OK) assertThat(entity.body).isEqualTo("foobar") } @@ -195,7 +195,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() { @GetMapping("/entity-flux") suspend fun entityFlux() : ResponseEntity> { - val strings = Flux.just("foo", "bar"); + val strings = Flux.just("foo", "bar") delay(1) return ResponseEntity.ok().body(strings) } diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerKotlinTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerKotlinTests.kt index 20fc9b112c5b..041bd9c8ca36 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerKotlinTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerKotlinTests.kt @@ -37,7 +37,6 @@ import org.springframework.web.testfixture.server.MockServerWebExchange import reactor.test.StepVerifier import java.nio.charset.StandardCharsets import java.time.Duration -import java.util.* /** * Kotlin unit tests for [AbstractMessageWriterResultHandler]. From 7e5afc8bbb84bfbacea356cd08814e7e21f10d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Thu, 28 Dec 2023 11:47:17 +0100 Subject: [PATCH 2/2] Update copyright year of changed files See gh-31913 --- ...AutoProxyInterceptorKotlinIntegrationTests.kt | 16 ++++++++++++++++ .../beans/KotlinBeanUtilsBenchmark.kt | 2 +- .../jdbc/core/JdbcOperationsExtensions.kt | 4 ++-- .../function/server/RouterFunctionDsl.kt | 2 +- .../function/server/RouterFunctionDslTests.kt | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt b/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt index e0b4f9c44a5b..4020eae298ee 100644 --- a/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt +++ b/integration-tests/src/test/kotlin/org/springframework/aop/framework/autoproxy/AspectJAutoProxyInterceptorKotlinIntegrationTests.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2002-2023 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.aop.framework.autoproxy import kotlinx.coroutines.delay diff --git a/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt b/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt index 6c50b34cfe34..44fd7e654c0e 100644 --- a/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt +++ b/spring-beans/src/jmh/kotlin/org/springframework/beans/KotlinBeanUtilsBenchmark.kt @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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. diff --git a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt index adca16a2587f..08c7e04174c4 100644 --- a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt +++ b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt @@ -1,11 +1,11 @@ /* - * Copyright 2002-2021 the original author or authors + * Copyright 2002-2023 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt index 605e2908f222..d2c29754963d 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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. diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt index 2b12c40fd32b..b9b5dab60a15 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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.