From 5f8443b94a94c6fc5cdecf2c91d89b48e3eb6598 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 12 Mar 2020 13:16:04 +0100 Subject: Remove some experimental annotations --- .../kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt | 9 +++++---- .../kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt | 5 +---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision') diff --git a/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 4c1d8e6a..c4855466 100644 --- a/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -24,7 +24,6 @@ package pl.treksoft.kvision.remote import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue -import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ReceiveChannel @@ -53,8 +52,7 @@ import kotlin.reflect.KClass /** * Multiplatform service manager for Spring Boot. */ -@OptIn(ExperimentalCoroutinesApi::class) -@Suppress("LargeClass", "TooManyFunctions") +@Suppress("LargeClass", "TooManyFunctions", "BlockingMethodInNonBlockingContext") actual open class KVServiceManager actual constructor(val serviceClass: KClass) { companion object { @@ -450,6 +448,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: * @param function a function of the receiver * @param route a route */ + @OptIn(ExperimentalCoroutinesApi::class) protected actual inline fun bind( noinline function: suspend T.(ReceiveChannel, SendChannel) -> Unit, route: String? @@ -489,7 +488,7 @@ actual open class KVServiceManager actual constructor(val serviceClass: } if (!incoming.isClosedForReceive) incoming.cancel() } - launch(start = CoroutineStart.UNDISPATCHED) { + launch { function.invoke(service, requestChannel, responseChannel) if (!responseChannel.isClosedForReceive) responseChannel.close() } @@ -515,8 +514,10 @@ actual open class KVServiceManager actual constructor(val serviceClass: val param1 = getParameter(jsonRpcRequest.params[0]) val param2 = getParameter(jsonRpcRequest.params[1]) val param3 = getParameter?>(jsonRpcRequest.params[2]) + @Suppress("MagicNumber") val param4 = getParameter?>(jsonRpcRequest.params[3]) + @Suppress("MagicNumber") val param5 = getParameter(jsonRpcRequest.params[4]) try { diff --git a/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt index 3c0e4e99..d707f6c4 100644 --- a/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt +++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt @@ -24,7 +24,6 @@ package pl.treksoft.kvision.remote import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ReceiveChannel @@ -63,9 +62,7 @@ class KVWebSocketHandler( }.first() } - @OptIn( - ExperimentalCoroutinesApi::class, FlowPreview::class - ) + @OptIn(ExperimentalCoroutinesApi::class) override fun handle(session: WebSocketSession): Mono { val handler = getHandler(session) val responseChannel = Channel() -- cgit