From 611811d8fc8b96d7983cf2d3d261727c3c12f66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Fri, 23 Jan 2026 18:34:21 +0100 Subject: [PATCH] Anticipate fixing Kotlin 2.3 compilation warning Closes gh-36203 --- .../springframework/aop/support/AopUtilsKotlinTests.kt | 2 +- .../hint/BindingReflectionHintsRegistrarKotlinTests.kt | 2 +- .../core/GenericTypeResolverKotlinTests.kt | 2 +- .../springframework/core/MethodParameterKotlinTests.kt | 4 ++-- .../springframework/r2dbc/core/RowsFetchSpecExtensions.kt | 8 ++++---- .../test/web/servlet/MockMvcResultMatchersDsl.kt | 2 +- .../web/servlet/result/FlashAttributeResultMatchersDsl.kt | 2 +- .../test/web/servlet/result/JsonPathResultMatchersDsl.kt | 2 +- .../test/web/servlet/result/ModelResultMatchersDsl.kt | 2 +- .../test/web/servlet/result/RequestResultMatchersDsl.kt | 6 +++--- 10 files changed, 16 insertions(+), 16 deletions(-) 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 cb14fbb9be0..a233abfe4c7 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 { @Test fun `Invoking suspending function on bridged method should return Mono`() { val value = "foo" - val bridgedMethod = ReflectionUtils.findMethod(WithInterface::class.java, "handle", Object::class.java, Continuation::class.java)!! + val bridgedMethod = ReflectionUtils.findMethod(WithInterface::class.java, "handle", Any::class.java, Continuation::class.java)!! val continuation = Continuation(CoroutineName("test")) { } val result = AopUtils.invokeJoinpointUsingReflection(WithInterface(), bridgedMethod, arrayOf(value, continuation)) assertThat(result).isInstanceOfSatisfying(Mono::class.java) { diff --git a/spring-core/src/test/kotlin/org/springframework/aot/hint/BindingReflectionHintsRegistrarKotlinTests.kt b/spring-core/src/test/kotlin/org/springframework/aot/hint/BindingReflectionHintsRegistrarKotlinTests.kt index 628e087aa66..3109ec8e919 100644 --- a/spring-core/src/test/kotlin/org/springframework/aot/hint/BindingReflectionHintsRegistrarKotlinTests.kt +++ b/spring-core/src/test/kotlin/org/springframework/aot/hint/BindingReflectionHintsRegistrarKotlinTests.kt @@ -71,7 +71,7 @@ class BindingReflectionHintsRegistrarKotlinTests { assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(SampleDataClass::class.java, "isNonNullable")).accepts(hints) assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(SampleDataClass::class.java, "isNullable")).accepts(hints) val copyDefault: Method = SampleDataClass::class.java.getMethod("copy\$default", SampleDataClass::class.java, - String::class.java, Boolean::class.javaPrimitiveType, Boolean::class.javaObjectType, Int::class.java, Object::class.java) + String::class.java, Boolean::class.javaPrimitiveType, Boolean::class.javaObjectType, Int::class.java, Any::class.java) assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(copyDefault)).accepts(hints) } diff --git a/spring-core/src/test/kotlin/org/springframework/core/GenericTypeResolverKotlinTests.kt b/spring-core/src/test/kotlin/org/springframework/core/GenericTypeResolverKotlinTests.kt index f57ca1fa203..14c3194137b 100644 --- a/spring-core/src/test/kotlin/org/springframework/core/GenericTypeResolverKotlinTests.kt +++ b/spring-core/src/test/kotlin/org/springframework/core/GenericTypeResolverKotlinTests.kt @@ -32,7 +32,7 @@ class GenericTypeResolverKotlinTests { @Test fun methodReturnTypes() { assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods::class.java, "integer")!!, - MyInterfaceType::class.java)).isEqualTo(Integer::class.java) + MyInterfaceType::class.java)).isEqualTo(Int::class.javaObjectType) assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods::class.java, "string")!!, MyInterfaceType::class.java)).isEqualTo(String::class.java) assertThat(resolveReturnTypeArgument(findMethod(MyTypeWithMethods::class.java, "raw")!!, diff --git a/spring-core/src/test/kotlin/org/springframework/core/MethodParameterKotlinTests.kt b/spring-core/src/test/kotlin/org/springframework/core/MethodParameterKotlinTests.kt index 7d2a24392e1..d63dae5ae5d 100644 --- a/spring-core/src/test/kotlin/org/springframework/core/MethodParameterKotlinTests.kt +++ b/spring-core/src/test/kotlin/org/springframework/core/MethodParameterKotlinTests.kt @@ -110,8 +110,8 @@ class MethodParameterKotlinTests { assertThat(returnGenericParameterType("suspendFun7")).isInstanceOf(TypeVariable::class.java) assertThat(returnGenericParameterTypeBoundName("suspendFun7")).isEqualTo("org.springframework.core.Consumer") - assertThat(returnParameterType("suspendFun8")).isEqualTo(Object::class.java) - assertThat(returnGenericParameterType("suspendFun8")).isEqualTo(Object::class.java) + assertThat(returnParameterType("suspendFun8")).isEqualTo(Any::class.java) + assertThat(returnGenericParameterType("suspendFun8")).isEqualTo(Any::class.java) } @Test diff --git a/spring-r2dbc/src/main/kotlin/org/springframework/r2dbc/core/RowsFetchSpecExtensions.kt b/spring-r2dbc/src/main/kotlin/org/springframework/r2dbc/core/RowsFetchSpecExtensions.kt index d162fa6491e..1fb9ebf391e 100644 --- a/spring-r2dbc/src/main/kotlin/org/springframework/r2dbc/core/RowsFetchSpecExtensions.kt +++ b/spring-r2dbc/src/main/kotlin/org/springframework/r2dbc/core/RowsFetchSpecExtensions.kt @@ -28,7 +28,7 @@ import reactor.core.publisher.Mono * @author Sebastien Deleuze */ @Suppress("DEPRECATION") -suspend fun RowsFetchSpec.awaitOne(): T { +suspend fun RowsFetchSpec.awaitOne(): T { return one().awaitSingleOrNull() ?: throw EmptyResultDataAccessException(1) } @@ -38,7 +38,7 @@ suspend fun RowsFetchSpec.awaitOne(): T { * @author Sebastien Deleuze */ @Suppress("DEPRECATION") -suspend fun RowsFetchSpec.awaitOneOrNull(): T? = +suspend fun RowsFetchSpec.awaitOneOrNull(): T? = one().awaitSingleOrNull() /** @@ -48,7 +48,7 @@ suspend fun RowsFetchSpec.awaitOneOrNull(): T? = * @author Sebastien Deleuze */ @Suppress("DEPRECATION") -suspend fun RowsFetchSpec.awaitSingle(): T { +suspend fun RowsFetchSpec.awaitSingle(): T { return first().awaitSingleOrNull() ?: throw EmptyResultDataAccessException(1) } @@ -58,7 +58,7 @@ suspend fun RowsFetchSpec.awaitSingle(): T { * @author Sebastien Deleuze */ @Suppress("DEPRECATION") -suspend fun RowsFetchSpec.awaitSingleOrNull(): T? = +suspend fun RowsFetchSpec.awaitSingleOrNull(): T? = first().awaitSingleOrNull() /** diff --git a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/MockMvcResultMatchersDsl.kt b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/MockMvcResultMatchersDsl.kt index e6299cbd032..f2e38e114ea 100644 --- a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/MockMvcResultMatchersDsl.kt +++ b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/MockMvcResultMatchersDsl.kt @@ -114,7 +114,7 @@ class MockMvcResultMatchersDsl(private val actions: ResultActions) { /** * @see MockMvcResultMatchers.jsonPath */ - fun jsonPath(expression: String, matcher: Matcher) { + fun jsonPath(expression: String, matcher: Matcher) { actions.andExpect(MockMvcResultMatchers.jsonPath(expression, matcher)) } diff --git a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/FlashAttributeResultMatchersDsl.kt b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/FlashAttributeResultMatchersDsl.kt index 05593e07e7e..8e5d7c414c9 100644 --- a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/FlashAttributeResultMatchersDsl.kt +++ b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/FlashAttributeResultMatchersDsl.kt @@ -32,7 +32,7 @@ class FlashAttributeResultMatchersDsl internal constructor (private val actions: /** * @see FlashAttributeResultMatchers.attribute */ - fun attribute(name: String, matcher: Matcher) { + fun attribute(name: String, matcher: Matcher) { actions.andExpect(matchers.attribute(name, matcher)) } diff --git a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/JsonPathResultMatchersDsl.kt b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/JsonPathResultMatchersDsl.kt index 4cdd221902f..7f1dc4d03e9 100644 --- a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/JsonPathResultMatchersDsl.kt +++ b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/JsonPathResultMatchersDsl.kt @@ -40,7 +40,7 @@ class JsonPathResultMatchersDsl internal constructor(@PublishedApi internal val /** * @see JsonPathResultMatchers.value */ - inline fun value(matcher: Matcher) { + inline fun value(matcher: Matcher) { actions.andExpect(matchers.value(matcher, T::class.java)) } diff --git a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/ModelResultMatchersDsl.kt b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/ModelResultMatchersDsl.kt index 9422c33d3a8..0290f583602 100644 --- a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/ModelResultMatchersDsl.kt +++ b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/ModelResultMatchersDsl.kt @@ -32,7 +32,7 @@ class ModelResultMatchersDsl internal constructor (private val actions: ResultAc /** * @see ModelResultMatchers.attribute */ - fun attribute(name: String, matcher: Matcher) { + fun attribute(name: String, matcher: Matcher) { actions.andExpect(matchers.attribute(name, matcher)) } diff --git a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/RequestResultMatchersDsl.kt b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/RequestResultMatchersDsl.kt index d3c7dd2656b..a4ece1f4dc8 100644 --- a/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/RequestResultMatchersDsl.kt +++ b/spring-test/src/main/kotlin/org/springframework/test/web/servlet/result/RequestResultMatchersDsl.kt @@ -46,7 +46,7 @@ class RequestResultMatchersDsl internal constructor (private val actions: Result /** * @see RequestResultMatchers.asyncResult */ - fun asyncResult(matcher: Matcher) { + fun asyncResult(matcher: Matcher) { actions.andExpect(matchers.asyncResult(matcher)) } @@ -60,7 +60,7 @@ class RequestResultMatchersDsl internal constructor (private val actions: Result /** * @see RequestResultMatchers.attribute */ - fun attribute(name: String, matcher: Matcher) { + fun attribute(name: String, matcher: Matcher) { actions.andExpect(matchers.attribute(name, matcher)) } @@ -74,7 +74,7 @@ class RequestResultMatchersDsl internal constructor (private val actions: Result /** * @see RequestResultMatchers.sessionAttribute */ - fun sessionAttribute(name: String, matcher: Matcher) { + fun sessionAttribute(name: String, matcher: Matcher) { actions.andExpect(matchers.sessionAttribute(name, matcher)) }