From 5d8008a4f79e2c35a3d22c4bef00308861a65b39 Mon Sep 17 00:00:00 2001 From: Nikita Nazarov Date: Tue, 29 Oct 2024 00:47:27 +0100 Subject: [PATCH] [kotlin] Don't throw when exception occurred in the completable future Sometimes when computing classes with inlined code, an ObjectCollectedException could be thrown in on of the futures. This resulted in failure of `CompleatableFuture.allOf(*futures)`. Because of this, smart stepping and breakpoints in inline functions sometimes didn't work, which was easy to observe when debugging on Android. --- .../kotlin/idea/debugger/core/KotlinPositionManager.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinPositionManager.kt b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinPositionManager.kt index 7633a191a1bea..66d199419ada1 100644 --- a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinPositionManager.kt +++ b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinPositionManager.kt @@ -610,9 +610,9 @@ class KotlinPositionManager(private val debugProcess: DebugProcess) : MultiReque private fun getClassesWithInlinedCode(candidatesWithInline: List, line: Int): List { val candidatesWithInlineInternalNames = candidatesWithInline.map { it.fqnToInternalName() } val futures = debugProcess.virtualMachineProxy.allClasses().map { type -> - hasInlinedLinesToAsync(type, line, candidatesWithInlineInternalNames).thenApply { hasInlinedLines -> - type.takeIf { hasInlinedLines } - } + hasInlinedLinesToAsync(type, line, candidatesWithInlineInternalNames) + .thenApply { hasInlinedLines -> type.takeIf { hasInlinedLines } } + .exceptionally { null } }.toTypedArray() CompletableFuture.allOf(*futures).join() return futures.mapNotNull { it.get() }