Smart step into skips methods from subclasses
#KT-11705 Fixed
This commit is contained in:
@@ -19,11 +19,15 @@ package org.jetbrains.kotlin.idea.debugger.stepping
|
|||||||
import com.intellij.debugger.SourcePosition
|
import com.intellij.debugger.SourcePosition
|
||||||
import com.intellij.debugger.engine.DebugProcessImpl
|
import com.intellij.debugger.engine.DebugProcessImpl
|
||||||
import com.intellij.debugger.engine.NamedMethodFilter
|
import com.intellij.debugger.engine.NamedMethodFilter
|
||||||
|
import com.intellij.debugger.impl.DebuggerUtilsEx
|
||||||
import com.intellij.util.Range
|
import com.intellij.util.Range
|
||||||
import com.sun.jdi.Location
|
import com.sun.jdi.Location
|
||||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
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(
|
class KotlinBasicStepMethodFilter(
|
||||||
val resolvedElement: KtElement,
|
val resolvedElement: KtElement,
|
||||||
@@ -53,6 +57,8 @@ class KotlinBasicStepMethodFilter(
|
|||||||
|
|
||||||
val classes = positionManager.getAllClasses(sourcePosition)
|
val classes = positionManager.getAllClasses(sourcePosition)
|
||||||
|
|
||||||
return classes.contains(location.declaringType())
|
return classes.any {
|
||||||
|
it == location.declaringType() || DebuggerUtilsEx.isAssignableFrom(it.name(), location.declaringType())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package smartStepIntoSubClass
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -619,6 +619,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
doCustomTest(fileName);
|
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")
|
@TestMetadata("stepIntoStdlibInlineFun2step.kt")
|
||||||
public void testStepIntoStdlibInlineFun2step() throws Exception {
|
public void testStepIntoStdlibInlineFun2step() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/stepIntoStdlibInlineFun2step.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/stepIntoStdlibInlineFun2step.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user