From 230f2f5ce038a513083a67f95ad401985c3ba447 Mon Sep 17 00:00:00 2001 From: Vladimir Ilmov Date: Fri, 19 Jun 2020 18:48:55 +0200 Subject: [PATCH] (CoroutineDebugger) fix for debugger agent for 1.3.6 version and up --- .../debugger/coroutine/DebuggerConnection.kt | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/DebuggerConnection.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/DebuggerConnection.kt index 7371dc23776..25069da7108 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/DebuggerConnection.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/DebuggerConnection.kt @@ -46,22 +46,18 @@ class DebuggerConnection( val kotlinxCoroutinesCore = params.classPath?.pathList?.firstOrNull { it.contains("kotlinx-coroutines-core") } val kotlinxCoroutinesDebug = params.classPath?.pathList?.firstOrNull { it.contains("kotlinx-coroutines-debug") } - val mode = when { - kotlinxCoroutinesCore != null -> { - val coreVersion = determineCoreVersionMode(kotlinxCoroutinesCore) - if (coreVersion == CoroutineDebuggerMode.DISABLED && kotlinxCoroutinesDebug != null) - CoroutineDebuggerMode.VERSION_UP_TO_1_3_5 - else - CoroutineDebuggerMode.DISABLED - } - kotlinxCoroutinesDebug != null -> CoroutineDebuggerMode.VERSION_UP_TO_1_3_5 - else -> CoroutineDebuggerMode.DISABLED - } + if (kotlinxCoroutinesCore != null) { + val coreVersion = determineCoreVersionMode(kotlinxCoroutinesCore) + val mode = if (coreVersion == CoroutineDebuggerMode.DISABLED && kotlinxCoroutinesDebug != null) + CoroutineDebuggerMode.VERSION_UP_TO_1_3_5 + else + coreVersion - when (mode) { - CoroutineDebuggerMode.VERSION_1_3_6_AND_UP -> initializeCoroutineAgent(params, kotlinxCoroutinesCore) - CoroutineDebuggerMode.VERSION_UP_TO_1_3_5 -> initializeCoroutineAgent(params, kotlinxCoroutinesDebug) - else -> log.debug("CoroutineDebugger disabled.") + when (mode) { + CoroutineDebuggerMode.VERSION_1_3_6_AND_UP -> initializeCoroutineAgent(params, kotlinxCoroutinesCore) + CoroutineDebuggerMode.VERSION_UP_TO_1_3_5 -> initializeCoroutineAgent(params, kotlinxCoroutinesDebug) + else -> log.debug("CoroutineDebugger disabled.") + } } } connect()