diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt index 36b5a336c5c..d2652172c53 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt @@ -101,7 +101,7 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq override fun getSourcePosition(location: Location?): SourcePosition? { if (location == null) throw NoDataException.INSTANCE - val fileName = location.safeSourceName ?: throw NoDataException.INSTANCE + val fileName = location.safeSourceName() ?: throw NoDataException.INSTANCE val lineNumber = location.safeLineNumber() if (lineNumber < 0) { throw NoDataException.INSTANCE @@ -157,7 +157,7 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq } val sameLineLocations = location.safeMethod()?.safeAllLineLocations()?.filter { - it.safeLineNumber() == lineNumber && it.safeSourceName == fileName + it.safeLineNumber() == lineNumber && it.safeSourceName() == fileName } if (sameLineLocations != null) { @@ -253,20 +253,8 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq return null } - private val Location.safeSourceName: String? get() { - return try { - sourceName() - } - catch (e: AbsentInformationException) { - null - } - catch (e: InternalError) { - null - } - } - private fun getPsiFileByLocation(location: Location): PsiFile? { - val sourceName = location.safeSourceName ?: return null + val sourceName = location.safeSourceName() ?: return null val referenceInternalName = try { if (location.declaringType().containsKotlinStrata()) { diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt index 8d16e4e819f..d07bf5bafc3 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt @@ -54,6 +54,16 @@ fun Method.safeVariables(): List { } } +fun Location.safeSourceName(): String? { + return try { + sourceName() + } catch (e: AbsentInformationException) { + null + } catch (e: InternalError) { + null + } +} + fun Location.safeLineNumber(): Int { return DebuggerUtilsEx.getLineNumber(this, false) }