Browse Source

Upgrade to Coroutines 1.3.2

Closes gh-23663
pull/1863/head
Sebastien Deleuze 6 years ago
parent
commit
091c512f0d
  1. 2
      build.gradle
  2. 2
      spring-core/kotlin-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt
  3. 2
      spring-messaging/src/main/kotlin/org/springframework/messaging/rsocket/RSocketRequesterExtensions.kt
  4. 4
      spring-messaging/src/test/kotlin/org/springframework/messaging/rsocket/RSocketClientToServerCoroutinesIntegrationTests.kt
  5. 2
      spring-messaging/src/test/kotlin/org/springframework/messaging/rsocket/RSocketRequesterExtensionsTests.kt
  6. 2
      spring-test/src/main/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensions.kt
  7. 2
      spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt
  8. 2
      spring-tx/src/main/kotlin/org/springframework/transaction/reactive/TransactionalOperatorExtensions.kt
  9. 3
      spring-tx/src/test/kotlin/org/springframework/transaction/reactive/TransactionalOperatorExtensionsTests.kt
  10. 2
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt
  11. 2
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt
  12. 2
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt
  13. 2
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensions.kt
  14. 2
      spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensionsTests.kt
  15. 2
      spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/WebClientExtensionsTests.kt
  16. 2
      spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensionsTests.kt
  17. 2
      spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensionsTests.kt

2
build.gradle

@ -48,7 +48,7 @@ configure(allprojects) { project -> @@ -48,7 +48,7 @@ configure(allprojects) { project ->
mavenBom "io.projectreactor:reactor-bom:Dysprosium-RELEASE"
mavenBom "org.eclipse.jetty:jetty-bom:9.4.20.v20190813"
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.3.50"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.1"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.2"
mavenBom "org.junit:junit-bom:5.5.2"
}
dependencies {

2
spring-core/kotlin-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt

@ -19,7 +19,6 @@ package org.springframework.core @@ -19,7 +19,6 @@ package org.springframework.core
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.flow.Flow
@ -59,7 +58,6 @@ internal fun <T: Any> monoToDeferred(source: Mono<T>) = @@ -59,7 +58,6 @@ internal fun <T: Any> monoToDeferred(source: Mono<T>) =
* @since 5.2
*/
@Suppress("UNCHECKED_CAST")
@ExperimentalCoroutinesApi
internal fun invokeSuspendingFunction(method: Method, bean: Any, vararg args: Any?): Any? {
val function = method.kotlinFunction!!
return if (function.isSuspend) {

2
spring-messaging/src/main/kotlin/org/springframework/messaging/rsocket/RSocketRequesterExtensions.kt

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.messaging.rsocket
import io.rsocket.transport.ClientTransport
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.awaitFirstOrNull
import kotlinx.coroutines.reactive.awaitSingle
@ -119,7 +118,6 @@ suspend inline fun <reified T : Any> RSocketRequester.RequestSpec.retrieveAndAwa @@ -119,7 +118,6 @@ suspend inline fun <reified T : Any> RSocketRequester.RequestSpec.retrieveAndAwa
* @author Sebastien Deleuze
* @since 5.2
*/
@ExperimentalCoroutinesApi
inline fun <reified T : Any> RSocketRequester.RequestSpec.retrieveFlow(): Flow<T> =
retrieveFlux(object : ParameterizedTypeReference<T>() {}).asFlow()

4
spring-messaging/src/test/kotlin/org/springframework/messaging/rsocket/RSocketClientToServerCoroutinesIntegrationTests.kt

@ -21,7 +21,6 @@ import io.rsocket.RSocketFactory @@ -21,7 +21,6 @@ import io.rsocket.RSocketFactory
import io.rsocket.frame.decoder.PayloadDecoder
import io.rsocket.transport.netty.server.CloseableChannel
import io.rsocket.transport.netty.server.TcpServerTransport
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
@ -49,7 +48,6 @@ import java.time.Duration @@ -49,7 +48,6 @@ import java.time.Duration
* @author Sebastien Deleuze
* @author Rossen Stoyanchev
*/
@ExperimentalCoroutinesApi
class RSocketClientToServerCoroutinesIntegrationTests {
@Test
@ -105,7 +103,6 @@ class RSocketClientToServerCoroutinesIntegrationTests { @@ -105,7 +103,6 @@ class RSocketClientToServerCoroutinesIntegrationTests {
.verify(Duration.ofSeconds(5))
}
@ExperimentalCoroutinesApi
@Controller
class ServerController {
@ -160,7 +157,6 @@ class RSocketClientToServerCoroutinesIntegrationTests { @@ -160,7 +157,6 @@ class RSocketClientToServerCoroutinesIntegrationTests {
@Configuration
open class ServerConfig {
@ExperimentalCoroutinesApi
@Bean
open fun controller(): ServerController {
return ServerController()

2
spring-messaging/src/test/kotlin/org/springframework/messaging/rsocket/RSocketRequesterExtensionsTests.kt

@ -18,7 +18,6 @@ package org.springframework.messaging.rsocket @@ -18,7 +18,6 @@ package org.springframework.messaging.rsocket
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
@ -122,7 +121,6 @@ class RSocketRequesterExtensionsTests { @@ -122,7 +121,6 @@ class RSocketRequesterExtensionsTests {
}
@Test
@ExperimentalCoroutinesApi
fun retrieveFlow() {
val requestSpec = mockk<RSocketRequester.RequestSpec>()
every { requestSpec.retrieveFlux(match<ParameterizedTypeReference<*>>(stringTypeRefMatcher)) } returns Flux.just("foo", "bar")

2
spring-test/src/main/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensions.kt

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.test.web.reactive.server
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import org.reactivestreams.Publisher
import org.springframework.core.ParameterizedTypeReference
@ -56,7 +55,6 @@ inline fun <reified T : Any> RequestBodySpec.body(producer: Any): RequestHeaders @@ -56,7 +55,6 @@ inline fun <reified T : Any> RequestBodySpec.body(producer: Any): RequestHeaders
* @author Sebastien Deleuze
* @since 5.2
*/
@ExperimentalCoroutinesApi
inline fun <reified T : Any> RequestBodySpec.body(flow: Flow<T>): RequestHeadersSpec<*> =
body(flow, object : ParameterizedTypeReference<T>() {})

2
spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt

@ -18,7 +18,6 @@ package org.springframework.test.web.reactive.server @@ -18,7 +18,6 @@ package org.springframework.test.web.reactive.server
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
@ -47,7 +46,6 @@ class WebTestClientExtensionsTests { @@ -47,7 +46,6 @@ class WebTestClientExtensionsTests {
}
@Test
@ExperimentalCoroutinesApi
fun `RequestBodySpec#body with Flow and reified type parameters`() {
val body = mockk<Flow<Foo>>()
requestBodySpec.body(body)

2
spring-tx/src/main/kotlin/org/springframework/transaction/reactive/TransactionalOperatorExtensions.kt

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
package org.springframework.transaction.reactive
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactive.awaitFirstOrNull
@ -15,7 +14,6 @@ import org.springframework.transaction.ReactiveTransaction @@ -15,7 +14,6 @@ import org.springframework.transaction.ReactiveTransaction
* @author Sebastien Deleuze
* @since 5.2
*/
@ExperimentalCoroutinesApi
fun <T : Any> Flow<T>.transactional(operator: TransactionalOperator): Flow<T> =
operator.transactional(asFlux()).asFlow()

3
spring-tx/src/test/kotlin/org/springframework/transaction/reactive/TransactionalOperatorExtensionsTests.kt

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.transaction.reactive
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.toList
@ -62,7 +61,6 @@ class TransactionalOperatorExtensionsTests { @@ -62,7 +61,6 @@ class TransactionalOperatorExtensionsTests {
}
@Test
@ExperimentalCoroutinesApi
fun commitWithFlow() {
val operator = TransactionalOperator.create(tm, DefaultTransactionDefinition())
val flow = flow {
@ -80,7 +78,6 @@ class TransactionalOperatorExtensionsTests { @@ -80,7 +78,6 @@ class TransactionalOperatorExtensionsTests {
}
@Test
@ExperimentalCoroutinesApi
fun rollbackWithFlow() {
val operator = TransactionalOperator.create(tm, DefaultTransactionDefinition())
val flow = flow<Int> {

2
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.web.reactive.function.client
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.awaitFirstOrNull
import kotlinx.coroutines.reactive.awaitSingle
@ -54,7 +53,6 @@ inline fun <reified T : Any> ClientResponse.bodyToFlux(): Flux<T> = @@ -54,7 +53,6 @@ inline fun <reified T : Any> ClientResponse.bodyToFlux(): Flux<T> =
* @author Sebastien Deleuze
* @since 5.2
*/
@ExperimentalCoroutinesApi
inline fun <reified T : Any> ClientResponse.bodyToFlow(): Flow<T> =
bodyToFlux<T>().asFlow()

2
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.web.reactive.function.client
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.reactive.asFlow
@ -103,7 +102,6 @@ inline fun <reified T : Any> WebClient.ResponseSpec.bodyToFlux(): Flux<T> = @@ -103,7 +102,6 @@ inline fun <reified T : Any> WebClient.ResponseSpec.bodyToFlux(): Flux<T> =
* @author Sebastien Deleuze
* @since 5.2
*/
@ExperimentalCoroutinesApi
inline fun <reified T : Any> WebClient.ResponseSpec.bodyToFlow(): Flow<T> =
bodyToFlux<T>().asFlow()

2
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.web.reactive.function.server
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.awaitFirstOrNull
import kotlinx.coroutines.reactive.awaitSingle
@ -57,7 +56,6 @@ inline fun <reified T : Any> ServerRequest.bodyToFlux(): Flux<T> = @@ -57,7 +56,6 @@ inline fun <reified T : Any> ServerRequest.bodyToFlux(): Flux<T> =
* @author Sebastien Deleuze
* @since 5.2
*/
@ExperimentalCoroutinesApi
inline fun <reified T : Any> ServerRequest.bodyToFlow(): Flow<T> =
bodyToFlux<T>().asFlow()

2
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensions.kt

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.web.reactive.function.server
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.awaitSingle
import org.reactivestreams.Publisher
@ -71,7 +70,6 @@ suspend fun ServerResponse.BodyBuilder.bodyValueAndAwait(body: Any): ServerRespo @@ -71,7 +70,6 @@ suspend fun ServerResponse.BodyBuilder.bodyValueAndAwait(body: Any): ServerRespo
* @author Sebastien Deleuze
* @since 5.2
*/
@ExperimentalCoroutinesApi
suspend inline fun <reified T : Any> ServerResponse.BodyBuilder.bodyAndAwait(flow: Flow<T>): ServerResponse =
body(flow, object : ParameterizedTypeReference<T>() {}).awaitSingle()

2
spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensionsTests.kt

@ -19,7 +19,6 @@ package org.springframework.web.reactive.function.client @@ -19,7 +19,6 @@ package org.springframework.web.reactive.function.client
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
@ -50,7 +49,6 @@ class ClientResponseExtensionsTests { @@ -50,7 +49,6 @@ class ClientResponseExtensionsTests {
}
@Test
@ExperimentalCoroutinesApi
fun `bodyToFlow with reified type parameters`() {
response.bodyToFlow<List<Foo>>()
verify { response.bodyToFlux(object : ParameterizedTypeReference<List<Foo>>() {}) }

2
spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/WebClientExtensionsTests.kt

@ -19,7 +19,6 @@ package org.springframework.web.reactive.function.client @@ -19,7 +19,6 @@ package org.springframework.web.reactive.function.client
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
@ -34,7 +33,6 @@ import java.util.concurrent.CompletableFuture @@ -34,7 +33,6 @@ import java.util.concurrent.CompletableFuture
*
* @author Sebastien Deleuze
*/
@ExperimentalCoroutinesApi
class WebClientExtensionsTests {
private val requestBodySpec = mockk<WebClient.RequestBodySpec>(relaxed = true)

2
spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensionsTests.kt

@ -19,7 +19,6 @@ package org.springframework.web.reactive.function.server @@ -19,7 +19,6 @@ package org.springframework.web.reactive.function.server
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
@ -52,7 +51,6 @@ class ServerRequestExtensionsTests { @@ -52,7 +51,6 @@ class ServerRequestExtensionsTests {
}
@Test
@ExperimentalCoroutinesApi
fun `bodyToFlow with reified type parameters`() {
request.bodyToFlow<List<Foo>>()
verify { request.bodyToFlux(object : ParameterizedTypeReference<List<Foo>>() {}) }

2
spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensionsTests.kt

@ -20,7 +20,6 @@ import io.mockk.every @@ -20,7 +20,6 @@ import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import io.reactivex.Flowable
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
@ -77,7 +76,6 @@ class ServerResponseExtensionsTests { @@ -77,7 +76,6 @@ class ServerResponseExtensionsTests {
}
@Test
@ExperimentalCoroutinesApi
fun `BodyBuilder#bodyAndAwait with flow parameter`() {
val response = mockk<ServerResponse>()
val body = mockk<Flow<List<Foo>>>()

Loading…
Cancel
Save