Debugger: step into default property getter/setter
#KT-7287 Fixed
This commit is contained in:
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
@@ -389,6 +390,11 @@ public class PropertyCodegen {
|
||||
PropertyDescriptor propertyDescriptor = callableDescriptor.getCorrespondingProperty();
|
||||
StackValue property = codegen.intermediateValueForProperty(propertyDescriptor, true, null, StackValue.LOCAL_0);
|
||||
|
||||
PsiElement jetProperty = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor);
|
||||
if (jetProperty instanceof JetProperty || jetProperty instanceof JetParameter) {
|
||||
codegen.markLineNumber((JetElement) jetProperty, false);
|
||||
}
|
||||
|
||||
if (callableDescriptor instanceof PropertyGetterDescriptor) {
|
||||
Type type = signature.getReturnType();
|
||||
property.put(type, v);
|
||||
|
||||
@@ -3,3 +3,7 @@ package customLib.simpleLibFile
|
||||
public fun foo() {
|
||||
1 + 1
|
||||
}
|
||||
|
||||
class B {
|
||||
public var prop: Int = 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
LineBreakpoint created at defaultAccessors.kt:5
|
||||
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! defaultAccessors.DefaultAccessorsPackage
|
||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
defaultAccessors.kt:5
|
||||
defaultAccessors.kt:11
|
||||
defaultAccessors.kt:17
|
||||
defaultAccessors.kt:11
|
||||
defaultAccessors.kt:12
|
||||
defaultAccessors.kt:17
|
||||
defaultAccessors.kt:13
|
||||
defaultAccessors.kt:6
|
||||
defaultAccessors.kt:21
|
||||
defaultAccessors.kt:22
|
||||
simpleLibFile.kt:8
|
||||
defaultAccessors.kt:22
|
||||
defaultAccessors.kt:23
|
||||
simpleLibFile.kt:8
|
||||
defaultAccessors.kt:24
|
||||
defaultAccessors.kt:7
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
@@ -0,0 +1,28 @@
|
||||
package defaultAccessors
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
//Breakpoint!
|
||||
A().testPublicPropertyInClass()
|
||||
testPublicPropertyInLibrary()
|
||||
}
|
||||
|
||||
class A: B() {
|
||||
fun testPublicPropertyInClass() {
|
||||
prop
|
||||
prop = 2
|
||||
}
|
||||
}
|
||||
|
||||
open class B {
|
||||
public var prop: Int = 1
|
||||
}
|
||||
|
||||
fun testPublicPropertyInLibrary() {
|
||||
val myClass = customLib.simpleLibFile.B()
|
||||
myClass.prop
|
||||
myClass.prop = 2
|
||||
}
|
||||
|
||||
// STEP_INTO: 21
|
||||
// SKIP_SYNTHETIC_METHODS: true
|
||||
// SKIP_CONSTRUCTORS: true
|
||||
@@ -61,6 +61,7 @@ abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() {
|
||||
debuggerSettings.SKIP_CONSTRUCTORS = fileText.getValueForSetting("SKIP_CONSTRUCTORS", oldSettings.SKIP_CONSTRUCTORS)
|
||||
debuggerSettings.SKIP_CLASSLOADERS = fileText.getValueForSetting("SKIP_CLASSLOADERS", oldSettings.SKIP_CLASSLOADERS)
|
||||
debuggerSettings.TRACING_FILTERS_ENABLED = fileText.getValueForSetting("TRACING_FILTERS_ENABLED", oldSettings.TRACING_FILTERS_ENABLED)
|
||||
debuggerSettings.SKIP_GETTERS = fileText.getValueForSetting("SKIP_GETTERS", oldSettings.SKIP_GETTERS)
|
||||
}
|
||||
|
||||
private fun String.getValueForSetting(name: String, defaultValue: Boolean): Boolean {
|
||||
@@ -84,6 +85,7 @@ abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() {
|
||||
debuggerSettings.SKIP_CONSTRUCTORS = oldSettings.SKIP_CONSTRUCTORS
|
||||
debuggerSettings.SKIP_CLASSLOADERS = oldSettings.SKIP_CLASSLOADERS
|
||||
debuggerSettings.TRACING_FILTERS_ENABLED = oldSettings.TRACING_FILTERS_ENABLED
|
||||
debuggerSettings.SKIP_GETTERS = oldSettings.SKIP_GETTERS
|
||||
}
|
||||
|
||||
protected val dp: DebugProcessImpl
|
||||
|
||||
@@ -223,6 +223,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
||||
doStepIntoTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultAccessors.kt")
|
||||
public void testDefaultAccessors() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/defaultAccessors.kt");
|
||||
doStepIntoTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forLoop.kt")
|
||||
public void testForLoop() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/forLoop.kt");
|
||||
|
||||
Reference in New Issue
Block a user