EA-210823: Fix AIE in breakpoint applicability test
This commit is contained in:
+7
-5
@@ -16,6 +16,7 @@ import com.sun.jdi.AbsentInformationException
|
|||||||
import com.sun.jdi.ReferenceType
|
import com.sun.jdi.ReferenceType
|
||||||
import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME
|
import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME
|
||||||
import org.jetbrains.kotlin.idea.debugger.isDexDebug
|
import org.jetbrains.kotlin.idea.debugger.isDexDebug
|
||||||
|
import org.jetbrains.kotlin.idea.debugger.safeSourceName
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||||
import org.jetbrains.kotlin.util.containingNonLocalDeclaration
|
import org.jetbrains.kotlin.util.containingNonLocalDeclaration
|
||||||
@@ -50,14 +51,15 @@ class KotlinLineBreakpoint(
|
|||||||
val lineNumber = sourcePosition.line + 1
|
val lineNumber = sourcePosition.line + 1
|
||||||
|
|
||||||
for (location in allLineLocations) {
|
for (location in allLineLocations) {
|
||||||
try {
|
val kotlinFileName = location.safeSourceName(KOTLIN_STRATA_NAME)
|
||||||
val kotlinFileName = location.sourceName(KOTLIN_STRATA_NAME)
|
val kotlinLineNumber = location.lineNumber(KOTLIN_STRATA_NAME)
|
||||||
val kotlinLineNumber = location.lineNumber(KOTLIN_STRATA_NAME)
|
|
||||||
|
if (kotlinFileName != null) {
|
||||||
if (kotlinFileName == fileName && kotlinLineNumber == lineNumber) {
|
if (kotlinFileName == fileName && kotlinLineNumber == lineNumber) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch (e: AbsentInformationException) {
|
} else {
|
||||||
if (location.sourceName() == fileName && location.lineNumber() == lineNumber) {
|
if (location.safeSourceName() == fileName && location.lineNumber() == lineNumber) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -62,7 +62,11 @@ fun StackFrameProxy.safeLocation(): Location? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Location.safeSourceName(): String? {
|
fun Location.safeSourceName(): String? {
|
||||||
return DebuggerUtilsEx.getSourceName(this) { null }
|
return wrapAbsentInformationException { this.sourceName() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Location.safeSourceName(stratum: String): String? {
|
||||||
|
return wrapAbsentInformationException { this.sourceName(stratum) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Location.safeLineNumber(): Int {
|
fun Location.safeLineNumber(): Int {
|
||||||
@@ -92,6 +96,8 @@ private inline fun <T> wrapAbsentInformationException(block: () -> T): T? {
|
|||||||
null
|
null
|
||||||
} catch (e: AbsentInformationEvaluateException) {
|
} catch (e: AbsentInformationEvaluateException) {
|
||||||
null
|
null
|
||||||
|
} catch (e: InternalException) {
|
||||||
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user