diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java index 33496bfb0a6..32c93006074 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java @@ -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); diff --git a/idea/testData/debugger/customLibraryForTinyApp/simpleLibFile/simpleLibFile.kt b/idea/testData/debugger/customLibraryForTinyApp/simpleLibFile/simpleLibFile.kt index 4d60d4322eb..dc299322546 100644 --- a/idea/testData/debugger/customLibraryForTinyApp/simpleLibFile/simpleLibFile.kt +++ b/idea/testData/debugger/customLibraryForTinyApp/simpleLibFile/simpleLibFile.kt @@ -3,3 +3,7 @@ package customLib.simpleLibFile public fun foo() { 1 + 1 } + +class B { + public var prop: Int = 1 +} diff --git a/idea/testData/debugger/tinyApp/outs/defaultAccessors.out b/idea/testData/debugger/tinyApp/outs/defaultAccessors.out new file mode 100644 index 00000000000..9c4b19c9ad4 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/defaultAccessors.out @@ -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 diff --git a/idea/testData/debugger/tinyApp/src/stepInto/stepInto/defaultAccessors.kt b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/defaultAccessors.kt new file mode 100644 index 00000000000..4ce9dd03d17 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/defaultAccessors.kt @@ -0,0 +1,28 @@ +package defaultAccessors + +fun main(args: Array) { + //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 \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt index bc05a71b0f4..19ecc6a39d5 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt @@ -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 diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java index 41330c064f8..74ec07614cd 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -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");