diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinBasicStepMethodFilter.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinBasicStepMethodFilter.kt index b1fb60ad1fe..6ac3c13bf55 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinBasicStepMethodFilter.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinBasicStepMethodFilter.kt @@ -19,11 +19,15 @@ package org.jetbrains.kotlin.idea.debugger.stepping import com.intellij.debugger.SourcePosition import com.intellij.debugger.engine.DebugProcessImpl import com.intellij.debugger.engine.NamedMethodFilter +import com.intellij.debugger.impl.DebuggerUtilsEx import com.intellij.util.Range import com.sun.jdi.Location import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.load.java.JvmAbi -import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.KtAnonymousInitializer +import org.jetbrains.kotlin.psi.KtConstructor +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.psi.KtPropertyAccessor class KotlinBasicStepMethodFilter( val resolvedElement: KtElement, @@ -53,6 +57,8 @@ class KotlinBasicStepMethodFilter( val classes = positionManager.getAllClasses(sourcePosition) - return classes.contains(location.declaringType()) + return classes.any { + it == location.declaringType() || DebuggerUtilsEx.isAssignableFrom(it.name(), location.declaringType()) + } } } \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/outs/smartStepIntoSubClass.out b/idea/testData/debugger/tinyApp/outs/smartStepIntoSubClass.out new file mode 100644 index 00000000000..1fb02f9b2ab --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/smartStepIntoSubClass.out @@ -0,0 +1,8 @@ +LineBreakpoint created at smartStepIntoSubClass.kt:7 +!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! smartStepIntoSubClass.SmartStepIntoSubClassKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +smartStepIntoSubClass.kt:7 +smartStepIntoSubClass.kt:18 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoSubClass.kt b/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoSubClass.kt new file mode 100644 index 00000000000..7b8f8366659 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoSubClass.kt @@ -0,0 +1,20 @@ +package smartStepIntoSubClass + +fun main(args: Array) { + val x: Base = Impl() + // SMART_STEP_INTO_BY_INDEX: 1 + //Breakpoint! + x.foo(args.toString()) +} + +open class Base { + open fun foo(s: String) { + val a = 1 + } +} + +class Impl: Base() { + override fun foo(s: String) { + val b = 1 + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java index 13c8fbc85dd..85b3e20798f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -619,6 +619,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { doCustomTest(fileName); } + @TestMetadata("smartStepIntoSubClass.kt") + public void testSmartStepIntoSubClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoSubClass.kt"); + doCustomTest(fileName); + } + @TestMetadata("stepIntoStdlibInlineFun2step.kt") public void testStepIntoStdlibInlineFun2step() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/stepIntoStdlibInlineFun2step.kt");