diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt index ac2f3ef8fd2..23d97ed528e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt @@ -261,12 +261,12 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq val line = position.line + 1 - val locations = type.locationsOfLine(KOTLIN_STRATA_NAME, null, line).filter { it.sourceName(KOTLIN_STRATA_NAME) == position.file.name } - if (locations.isEmpty()) { + val locations = type.locationsOfLine(KOTLIN_STRATA_NAME, null, line) + if (locations == null || locations.isEmpty()) { throw NoDataException.INSTANCE } - return locations + return locations.filter { it.sourceName(KOTLIN_STRATA_NAME) == position.file.name } } catch (e: AbsentInformationException) { throw NoDataException.INSTANCE diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.Other.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.Other.kt new file mode 100644 index 00000000000..3a1471ac8a9 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.Other.kt @@ -0,0 +1,11 @@ +package stopInWrongClass + +class A { + fun test() { + // Breakpoint 1 + foo() + } +} + +fun foo() { +} \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.kt new file mode 100644 index 00000000000..c93aba7d28d --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.kt @@ -0,0 +1,21 @@ +package stopInWrongClass + +class AA { + fun test() { + // Should be on the same line with Breakpoint 1 + foo() + } + + fun other() { + //Breakpoint! + foo() + } +} + +fun main(args: Array) { + // Shouldn't stop inside test() + AA().test() + AA().other() +} + +// ADDITIONAL_BREAKPOINT: stopInWrongClass.Other.kt: Breakpoint 1 \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.out b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.out new file mode 100644 index 00000000000..68f6503700d --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.out @@ -0,0 +1,9 @@ +LineBreakpoint created at stopInWrongClass.Other.kt:6 +LineBreakpoint created at stopInWrongClass.kt:11 +Run Java +Connected to the target VM +stopInWrongClass.kt:11 +stopInWrongClass.kt:12 +Disconnected from the target VM + +Process finished with exit code 0 diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java index b6068e0d375..5d9e164a8e2 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -998,6 +998,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { doStepOverTest(fileName); } + @TestMetadata("stopInWrongClass.kt") + public void testStopInWrongClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInWrongClass.kt"); + doStepOverTest(fileName); + } + @TestMetadata("stopInlineCallInLocalFunInSecondaryConstructor.kt") public void testStopInlineCallInLocalFunInSecondaryConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInlineCallInLocalFunInSecondaryConstructor.kt");