202: Fix KotlinEvaluateExpressionTestGenerated.SingleBreakpoint

Now `getTreeEvaluation` returns `CompletableFuture<PsiElement>` not `PsiElement` as it was in 201
This commit is contained in:
Nikita Bobko
2020-06-17 18:52:34 +03:00
parent 046030e301
commit 536c4bbab1
@@ -21,6 +21,7 @@ import com.intellij.openapi.roots.JdkOrderEntry
import com.intellij.openapi.roots.libraries.LibraryUtil
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.io.FileUtil
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiExpression
import com.intellij.xdebugger.impl.XDebugSessionImpl
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl
@@ -40,6 +41,7 @@ import org.jetbrains.kotlin.idea.debugger.test.preference.DebuggerPreferences
import org.jetbrains.kotlin.idea.debugger.test.util.PrinterConfig.DescriptorViewOptions
import org.jetbrains.kotlin.psi.KtFile
import java.io.Closeable
import java.util.concurrent.CompletableFuture
import javax.swing.tree.TreeNode
class FramePrinter(
@@ -218,8 +220,12 @@ private class Printer(private val delegate: FramePrinterDelegate, private val co
}
if (config.shouldRenderExpression() && descriptor is ValueDescriptorImpl) {
val expression = debugProcess.invokeInManagerThread {
descriptor.getTreeEvaluation((node as XValueNodeImpl).valueContainer as JavaValue, it) as? PsiExpression
val expression = debugProcess.invokeInManagerThread { debuggerContextImpl ->
descriptor.getTreeEvaluation((node as XValueNodeImpl).valueContainer as JavaValue, debuggerContextImpl).let {
// FIX ME WHEN BUNCH 201 REMOVED: getTreeEvaluation in 202 returns CompletableFuture<PsiElement> but in older platforms it's PsiElement
@Suppress("UNCHECKED_CAST")
(it as? CompletableFuture<PsiElement>)?.get() ?: it
} as? PsiExpression
}
if (expression != null) {