Fix smart step into to Kotlin SAM adapter (KT-21538)
#KT-21538 Fixed
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.util.Range
|
|||||||
import com.intellij.util.SofterReference
|
import com.intellij.util.SofterReference
|
||||||
import com.sun.jdi.Location
|
import com.sun.jdi.Location
|
||||||
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
|
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
|
||||||
|
import org.jetbrains.kotlin.codegen.SamCodegenUtil
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.*
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.*
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
||||||
@@ -44,7 +45,9 @@ class KotlinBasicStepMethodFilter(
|
|||||||
else -> targetDescriptor.name.asString()
|
else -> targetDescriptor.name.asString()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val _targetDescriptor = SofterReference(targetDescriptor)
|
private val _targetDescriptor = SofterReference(
|
||||||
|
(targetDescriptor as? FunctionDescriptor)?.let { SamCodegenUtil.getOriginalIfSamAdapter(it) } ?: targetDescriptor
|
||||||
|
)
|
||||||
|
|
||||||
override fun getCallingExpressionLines() = myCallingExpressionLines
|
override fun getCallingExpressionLines() = myCallingExpressionLines
|
||||||
|
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package kotlinSamFunction
|
||||||
|
|
||||||
|
import forTests.MyJavaClass
|
||||||
|
|
||||||
|
class KotlinSubclass : MyJavaClass() {
|
||||||
|
override fun other(runnable: Runnable) {
|
||||||
|
super.other(runnable)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val klass = KotlinSubclass()
|
||||||
|
//Breakpoint!
|
||||||
|
klass.other { /* do nothing*/ }
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
LineBreakpoint created at kotlinSamFunction.kt:14
|
||||||
|
Run Java
|
||||||
|
Connected to the target VM
|
||||||
|
kotlinSamFunction.kt:14
|
||||||
|
kotlinSamFunction.kt:7
|
||||||
|
resuming kotlinSamFunction.kt:14
|
||||||
|
Disconnected from the target VM
|
||||||
|
|
||||||
|
Process finished with exit code 0
|
||||||
@@ -74,6 +74,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
doStepIntoTest(fileName);
|
doStepIntoTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinSamFunction.kt")
|
||||||
|
public void testKotlinSamFunction() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto/kotlinSamFunction.kt");
|
||||||
|
doStepIntoTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("memberFunFromClass.kt")
|
@TestMetadata("memberFunFromClass.kt")
|
||||||
public void testMemberFunFromClass() throws Exception {
|
public void testMemberFunFromClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto/memberFunFromClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto/memberFunFromClass.kt");
|
||||||
@@ -173,6 +179,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
doSmartStepIntoTest(fileName);
|
doSmartStepIntoTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinSamFunction.kt")
|
||||||
|
public void testKotlinSamFunction() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto/kotlinSamFunction.kt");
|
||||||
|
doSmartStepIntoTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("memberFunFromClass.kt")
|
@TestMetadata("memberFunFromClass.kt")
|
||||||
public void testMemberFunFromClass() throws Exception {
|
public void testMemberFunFromClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto/memberFunFromClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto/memberFunFromClass.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user