diff --git a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSimpleGetterProvider.kt b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSimpleGetterProvider.kt index 0d56e5ad8051..0d8a2056cf2a 100644 --- a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSimpleGetterProvider.kt +++ b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSimpleGetterProvider.kt @@ -7,11 +7,12 @@ import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.idea.base.psi.singleExpressionBody import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.getParentOfType class KotlinSimpleGetterProvider : SimplePropertyGetterProvider { override fun isInsideSimpleGetter(element: PsiElement): Boolean { // class A(val a: Int) - if (element is KtParameter) { + if (element.getParentOfType(false) != null) { return true } diff --git a/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK1CodeKotlinSteppingTestGenerated.java b/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK1CodeKotlinSteppingTestGenerated.java index 2f3c5f94ba6e..25c4ae106838 100644 --- a/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK1CodeKotlinSteppingTestGenerated.java +++ b/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK1CodeKotlinSteppingTestGenerated.java @@ -1658,6 +1658,11 @@ public abstract class K2IdeK1CodeKotlinSteppingTestGenerated extends AbstractK2I runTest("../testData/stepping/custom/simpleConditionalBreakpoint.kt"); } + @TestMetadata("skipSimpleGetters.kt") + public void testSkipSimpleGetters() throws Exception { + runTest("../testData/stepping/custom/skipSimpleGetters.kt"); + } + @TestMetadata("smartStepIntoAsyncLambda.kt") public void testSmartStepIntoAsyncLambda() throws Exception { runTest("../testData/stepping/custom/smartStepIntoAsyncLambda.kt"); diff --git a/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK2CodeKotlinSteppingTestGenerated.java b/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK2CodeKotlinSteppingTestGenerated.java index ae055cd7abc6..2b2f99219ead 100644 --- a/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK2CodeKotlinSteppingTestGenerated.java +++ b/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IdeK2CodeKotlinSteppingTestGenerated.java @@ -1658,6 +1658,11 @@ public abstract class K2IdeK2CodeKotlinSteppingTestGenerated extends AbstractK2I runTest("../testData/stepping/custom/simpleConditionalBreakpoint.kt"); } + @TestMetadata("skipSimpleGetters.kt") + public void testSkipSimpleGetters() throws Exception { + runTest("../testData/stepping/custom/skipSimpleGetters.kt"); + } + @TestMetadata("smartStepIntoAsyncLambda.kt") public void testSmartStepIntoAsyncLambda() throws Exception { runTest("../testData/stepping/custom/smartStepIntoAsyncLambda.kt"); diff --git a/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IndyLambdaKotlinSteppingTestGenerated.java b/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IndyLambdaKotlinSteppingTestGenerated.java index 9fb6324505c8..c071452d87c2 100644 --- a/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IndyLambdaKotlinSteppingTestGenerated.java +++ b/plugins/kotlin/jvm-debugger/test/k2/test/org/jetbrains/kotlin/idea/k2/debugger/test/cases/K2IndyLambdaKotlinSteppingTestGenerated.java @@ -1658,6 +1658,11 @@ public abstract class K2IndyLambdaKotlinSteppingTestGenerated extends AbstractK2 runTest("../testData/stepping/custom/simpleConditionalBreakpoint.kt"); } + @TestMetadata("skipSimpleGetters.kt") + public void testSkipSimpleGetters() throws Exception { + runTest("../testData/stepping/custom/skipSimpleGetters.kt"); + } + @TestMetadata("smartStepIntoAsyncLambda.kt") public void testSmartStepIntoAsyncLambda() throws Exception { runTest("../testData/stepping/custom/smartStepIntoAsyncLambda.kt"); diff --git a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IndyLambdaIrKotlinSteppingTestGenerated.java b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IndyLambdaIrKotlinSteppingTestGenerated.java index 62f7fb9b4dbb..e99461b43cae 100644 --- a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IndyLambdaIrKotlinSteppingTestGenerated.java +++ b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IndyLambdaIrKotlinSteppingTestGenerated.java @@ -1658,6 +1658,11 @@ public abstract class IndyLambdaIrKotlinSteppingTestGenerated extends AbstractIn runTest("testData/stepping/custom/simpleConditionalBreakpoint.kt"); } + @TestMetadata("skipSimpleGetters.kt") + public void testSkipSimpleGetters() throws Exception { + runTest("testData/stepping/custom/skipSimpleGetters.kt"); + } + @TestMetadata("smartStepIntoAsyncLambda.kt") public void testSmartStepIntoAsyncLambda() throws Exception { runTest("testData/stepping/custom/smartStepIntoAsyncLambda.kt"); diff --git a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinSteppingTestGenerated.java b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinSteppingTestGenerated.java index bf0b5212ae55..871f378dbb81 100644 --- a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinSteppingTestGenerated.java +++ b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/IrKotlinSteppingTestGenerated.java @@ -1658,6 +1658,11 @@ public abstract class IrKotlinSteppingTestGenerated extends AbstractIrKotlinStep runTest("testData/stepping/custom/simpleConditionalBreakpoint.kt"); } + @TestMetadata("skipSimpleGetters.kt") + public void testSkipSimpleGetters() throws Exception { + runTest("testData/stepping/custom/skipSimpleGetters.kt"); + } + @TestMetadata("smartStepIntoAsyncLambda.kt") public void testSmartStepIntoAsyncLambda() throws Exception { runTest("testData/stepping/custom/smartStepIntoAsyncLambda.kt"); diff --git a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/K1IdeK2CodeKotlinSteppingTestGenerated.java b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/K1IdeK2CodeKotlinSteppingTestGenerated.java index a866e7607582..08f8b6e63f72 100644 --- a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/K1IdeK2CodeKotlinSteppingTestGenerated.java +++ b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/K1IdeK2CodeKotlinSteppingTestGenerated.java @@ -1658,6 +1658,11 @@ public abstract class K1IdeK2CodeKotlinSteppingTestGenerated extends AbstractK1I runTest("testData/stepping/custom/simpleConditionalBreakpoint.kt"); } + @TestMetadata("skipSimpleGetters.kt") + public void testSkipSimpleGetters() throws Exception { + runTest("testData/stepping/custom/skipSimpleGetters.kt"); + } + @TestMetadata("smartStepIntoAsyncLambda.kt") public void testSmartStepIntoAsyncLambda() throws Exception { runTest("testData/stepping/custom/smartStepIntoAsyncLambda.kt"); diff --git a/plugins/kotlin/jvm-debugger/test/testData/stepping/custom/skipSimpleGetters.kt b/plugins/kotlin/jvm-debugger/test/testData/stepping/custom/skipSimpleGetters.kt new file mode 100644 index 000000000000..b1f2ea6a736b --- /dev/null +++ b/plugins/kotlin/jvm-debugger/test/testData/stepping/custom/skipSimpleGetters.kt @@ -0,0 +1,33 @@ +fun foo(name: String, age: Int): Any { + return name +} + +class User1( + val name: String, + val age: Int +) + +private fun test1() { + val user = User1("", 0) + // STEP_INTO: 1 + // RESUME: 1 + //Breakpoint! + foo(user.name, user.age) +} + +class User2(val name: String, val age: Int) + +private fun test2() { + val user = User2("", 0) + // STEP_INTO: 1 + // RESUME: 1 + //Breakpoint! + foo(user.name, user.age) +} + +fun main() { + test1() + test2() +} + +// SKIP_GETTERS: true diff --git a/plugins/kotlin/jvm-debugger/test/testData/stepping/custom/skipSimpleGetters.out b/plugins/kotlin/jvm-debugger/test/testData/stepping/custom/skipSimpleGetters.out new file mode 100644 index 000000000000..53baaa9aee58 --- /dev/null +++ b/plugins/kotlin/jvm-debugger/test/testData/stepping/custom/skipSimpleGetters.out @@ -0,0 +1,11 @@ +LineBreakpoint created at skipSimpleGetters.kt:15 +LineBreakpoint created at skipSimpleGetters.kt:25 +Run Java +Connected to the target VM +skipSimpleGetters.kt:15 +skipSimpleGetters.kt:2 +skipSimpleGetters.kt:25 +skipSimpleGetters.kt:2 +Disconnected from the target VM + +Process finished with exit code 0