Debugger: Handle case when we can't calculate the anonymous class name gracefully (EA-141202)
This commit is contained in:
+9
-6
@@ -24,7 +24,6 @@ import com.intellij.psi.util.PsiTreeUtil
|
|||||||
import com.sun.jdi.AbsentInformationException
|
import com.sun.jdi.AbsentInformationException
|
||||||
import com.sun.jdi.ObjectCollectedException
|
import com.sun.jdi.ObjectCollectedException
|
||||||
import com.sun.jdi.ReferenceType
|
import com.sun.jdi.ReferenceType
|
||||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass
|
|
||||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClassOrNull
|
import org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClassOrNull
|
||||||
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
||||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||||
@@ -222,15 +221,19 @@ class DebuggerClassNameProvider(
|
|||||||
is KtFunctionLiteral -> {
|
is KtFunctionLiteral -> {
|
||||||
val typeMapper = KotlinDebuggerCaches.getOrCreateTypeMapper(element)
|
val typeMapper = KotlinDebuggerCaches.getOrCreateTypeMapper(element)
|
||||||
|
|
||||||
val nonInlinedLambdaClassName = runReadAction {
|
val names = runReadAction {
|
||||||
asmTypeForAnonymousClass(typeMapper.bindingContext, element).internalName.toJdiName()
|
val name = asmTypeForAnonymousClassOrNull(typeMapper.bindingContext, element)?.internalName?.toJdiName()
|
||||||
|
if (name != null) Cached(name) else EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alwaysReturnLambdaParentClass && !InlineUtil.isInlinedArgument(element, typeMapper.bindingContext, true)) {
|
if (!names.isEmpty()
|
||||||
return Cached(nonInlinedLambdaClassName)
|
&& !alwaysReturnLambdaParentClass
|
||||||
|
&& !InlineUtil.isInlinedArgument(element, typeMapper.bindingContext, true)
|
||||||
|
) {
|
||||||
|
return names
|
||||||
}
|
}
|
||||||
|
|
||||||
Cached(nonInlinedLambdaClassName) + getOuterClassNamesForElement(element.relevantParentInReadAction)
|
names + getOuterClassNamesForElement(element.relevantParentInReadAction)
|
||||||
}
|
}
|
||||||
else -> getOuterClassNamesForElement(element.relevantParentInReadAction)
|
else -> getOuterClassNamesForElement(element.relevantParentInReadAction)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -229,6 +229,8 @@ class KotlinDebuggerCaches(project: Project) {
|
|||||||
fun NonCached(classNames: List<String>) = ComputedClassNames(classNames, false)
|
fun NonCached(classNames: List<String>) = ComputedClassNames(classNames, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isEmpty() = classNames.isEmpty()
|
||||||
|
|
||||||
fun distinct() = ComputedClassNames(classNames.distinct(), shouldBeCached)
|
fun distinct() = ComputedClassNames(classNames.distinct(), shouldBeCached)
|
||||||
|
|
||||||
operator fun plus(other: ComputedClassNames) = ComputedClassNames(
|
operator fun plus(other: ComputedClassNames) = ComputedClassNames(
|
||||||
|
|||||||
Reference in New Issue
Block a user