From f9399f05102f510056109a89792efc604a7ab65e Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Wed, 14 Oct 2015 20:11:04 +0300 Subject: [PATCH] Skip MultiFileFacade classes as synthethic --- .../KotlinSyntheticTypeComponentProvider.kt | 16 +++++++++++++--- .../breakpointOnLocalProperty/1/a1.kt | 2 ++ .../breakpointOnLocalProperty/2/a2.kt | 2 ++ .../oneFunSameClassName/1/a1.kt | 7 +++++++ .../oneFunSameClassName/2/a2.kt | 7 +++++++ .../oneFunSameFileName/1/a1.kt | 5 ----- .../oneFunSameFileName/2/a2.kt | 5 ----- .../customLibraryForTinyApp/property/1/a1.kt | 2 ++ .../customLibraryForTinyApp/property/2/a2.kt | 2 ++ .../twoFunDifferentSignature/1/a1.kt | 2 ++ .../twoFunDifferentSignature/2/a2.kt | 2 ++ .../debugger/tinyApp/outs/customLibClassName.out | 16 ++++++++-------- .../tinyApp/outs/stepIntoMultiFileFacade.out | 9 +++++++++ .../debugger/tinyApp/outs/stepIntoStdlib.out | 2 +- .../library/customLibClassName.kt | 2 +- .../stepping/filters/stepIntoMultiFileFacade.kt | 9 +++++++++ .../debugger/KotlinSteppingTestGenerated.java | 6 ++++++ 17 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/1/a1.kt create mode 100644 idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/2/a2.kt delete mode 100644 idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/1/a1.kt delete mode 100644 idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/2/a2.kt create mode 100644 idea/testData/debugger/tinyApp/outs/stepIntoMultiFileFacade.out create mode 100644 idea/testData/debugger/tinyApp/src/stepping/filters/stepIntoMultiFileFacade.kt diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt index 4ac70415a52..3b80dc2bf35 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt @@ -17,10 +17,9 @@ package org.jetbrains.kotlin.idea.debugger.filter import com.intellij.debugger.engine.SyntheticTypeComponentProvider +import com.sun.jdi.AbsentInformationException import com.sun.jdi.Method import com.sun.jdi.TypeComponent -import org.jetbrains.kotlin.load.kotlin.PackageClassUtils -import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqNameUnsafe public class KotlinSyntheticTypeComponentProvider: SyntheticTypeComponentProvider { @@ -30,6 +29,17 @@ public class KotlinSyntheticTypeComponentProvider: SyntheticTypeComponentProvide val typeName = typeComponent.declaringType().name() if (!FqNameUnsafe.isValid(typeName)) return false - return false + try { + if (typeComponent.location().lineNumber() != 1) return false + + if (typeComponent.allLineLocations().any { it.lineNumber() != 1 }) { + return false + } + + return !typeComponent.declaringType().allLineLocations().any { it.lineNumber() != 1 } + } + catch(e: AbsentInformationException) { + return false + } } } \ No newline at end of file diff --git a/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/1/a1.kt b/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/1/a1.kt index 10fab1a9ccc..3bc3474b2e4 100644 --- a/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/1/a1.kt +++ b/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/1/a1.kt @@ -1,3 +1,5 @@ +@file:JvmName("SameNameBreakpointOnLocalProperty") +@file:JvmMultifileClass package customLib.breakpointOnLocalProperty public fun breakpointOnLocalPropertyFun(): Int { diff --git a/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/2/a2.kt b/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/2/a2.kt index 691b0be946c..26e006d8774 100644 --- a/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/2/a2.kt +++ b/idea/testData/debugger/customLibraryForTinyApp/breakpointOnLocalProperty/2/a2.kt @@ -1,3 +1,5 @@ +@file:JvmName("SameNameBreakpointOnLocalProperty") +@file:JvmMultifileClass package customLib.breakpointOnLocalProperty public fun breakpointOnLocalPropertyFun2(): Int { diff --git a/idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/1/a1.kt b/idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/1/a1.kt new file mode 100644 index 00000000000..c8f530370d1 --- /dev/null +++ b/idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/1/a1.kt @@ -0,0 +1,7 @@ +@file:JvmName("SameNameOneFunSameFileName") +@file:JvmMultifileClass +package customLib.oneFunSameClassName + +public fun oneFunSameFileNameFun(): Int { + return 1 +} \ No newline at end of file diff --git a/idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/2/a2.kt b/idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/2/a2.kt new file mode 100644 index 00000000000..7bfb295cfb2 --- /dev/null +++ b/idea/testData/debugger/customLibraryForTinyApp/oneFunSameClassName/2/a2.kt @@ -0,0 +1,7 @@ +@file:JvmName("SameNameOneFunSameFileName") +@file:JvmMultifileClass +package customLib.oneFunSameClassName + +public fun oneFunSameFileNameFun2(): Int { + return 1 +} \ No newline at end of file diff --git a/idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/1/a1.kt b/idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/1/a1.kt deleted file mode 100644 index fc32dbe9cb0..00000000000 --- a/idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/1/a1.kt +++ /dev/null @@ -1,5 +0,0 @@ -package customLib.oneFunSameFileName - -public fun oneFunSameFileNameFun(): Int { - return 1 -} \ No newline at end of file diff --git a/idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/2/a2.kt b/idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/2/a2.kt deleted file mode 100644 index 0734de8f3e3..00000000000 --- a/idea/testData/debugger/customLibraryForTinyApp/oneFunSameFileName/2/a2.kt +++ /dev/null @@ -1,5 +0,0 @@ -package customLib.oneFunSameFileName - -public fun oneFunSameFileNameFun2(): Int { - return 1 -} \ No newline at end of file diff --git a/idea/testData/debugger/customLibraryForTinyApp/property/1/a1.kt b/idea/testData/debugger/customLibraryForTinyApp/property/1/a1.kt index 1acfa65f40d..5277d7fb203 100644 --- a/idea/testData/debugger/customLibraryForTinyApp/property/1/a1.kt +++ b/idea/testData/debugger/customLibraryForTinyApp/property/1/a1.kt @@ -1,3 +1,5 @@ +@file:JvmName("SameNameProperty") +@file:JvmMultifileClass package customLib.property public val foo: Int = diff --git a/idea/testData/debugger/customLibraryForTinyApp/property/2/a2.kt b/idea/testData/debugger/customLibraryForTinyApp/property/2/a2.kt index 23ddf508adf..410596e9568 100644 --- a/idea/testData/debugger/customLibraryForTinyApp/property/2/a2.kt +++ b/idea/testData/debugger/customLibraryForTinyApp/property/2/a2.kt @@ -1,3 +1,5 @@ +@file:JvmName("SameNameProperty") +@file:JvmMultifileClass package customLib.property public fun someFun(): Int { diff --git a/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/1/a1.kt b/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/1/a1.kt index 73b9a4baa21..a0dcfc14fe4 100644 --- a/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/1/a1.kt +++ b/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/1/a1.kt @@ -1,3 +1,5 @@ +@file:JvmName("SameNameTwoFunDifferentSignature") +@file:JvmMultifileClass package customLib.twoFunDifferentSignature public fun twoFunDifferentSignatureFun(): Int { diff --git a/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/2/a2.kt b/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/2/a2.kt index 2912f53a0b9..074d2f30b3f 100644 --- a/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/2/a2.kt +++ b/idea/testData/debugger/customLibraryForTinyApp/twoFunDifferentSignature/2/a2.kt @@ -1,3 +1,5 @@ +@file:JvmName("SameNameTwoFunDifferentSignature") +@file:JvmMultifileClass package customLib.twoFunDifferentSignature public fun twoFunDifferentSignatureFun(i: Int): Int { diff --git a/idea/testData/debugger/tinyApp/outs/customLibClassName.out b/idea/testData/debugger/tinyApp/outs/customLibClassName.out index c2f04dc339c..41719f6d33b 100644 --- a/idea/testData/debugger/tinyApp/outs/customLibClassName.out +++ b/idea/testData/debugger/tinyApp/outs/customLibClassName.out @@ -1,17 +1,17 @@ -LineBreakpoint created at a1.kt:3 -LineBreakpoint created at a1.kt:3 -LineBreakpoint created at a1.kt:3 -LineBreakpoint created at a1.kt:3 +LineBreakpoint created at a1.kt:5 +LineBreakpoint created at a1.kt:5 +LineBreakpoint created at a1.kt:5 +LineBreakpoint created at a1.kt:5 LineBreakpoint created at simpleLibFile.kt:3 !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! customLibClassName.CustomLibClassNameKt Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' -a1.kt:4 +a1.kt:6 Compile bytecode for 1 + 1 -a1.kt:4 +a1.kt:6 Compile bytecode for 1 + 2 -a1.kt:4 +a1.kt:6 Compile bytecode for 1 + 3 -a1.kt:4 +a1.kt:6 Compile bytecode for 1 + 4 simpleLibFile.kt:4 Compile bytecode for 1 + 5 diff --git a/idea/testData/debugger/tinyApp/outs/stepIntoMultiFileFacade.out b/idea/testData/debugger/tinyApp/outs/stepIntoMultiFileFacade.out new file mode 100644 index 00000000000..4ee4516cb68 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/stepIntoMultiFileFacade.out @@ -0,0 +1,9 @@ +LineBreakpoint created at stepIntoMultiFileFacade.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 !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! stepIntoMultiFileFacade.StepIntoMultiFileFacadeKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +stepIntoMultiFileFacade.kt:5 +a1.kt:6 +stepIntoMultiFileFacade.kt:5 +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/outs/stepIntoStdlib.out b/idea/testData/debugger/tinyApp/outs/stepIntoStdlib.out index b8172509190..cd85589ff5b 100644 --- a/idea/testData/debugger/tinyApp/outs/stepIntoStdlib.out +++ b/idea/testData/debugger/tinyApp/outs/stepIntoStdlib.out @@ -2,7 +2,7 @@ LineBreakpoint created at stepIntoStdlib.kt:6 !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! stepIntoStdlib.StepIntoStdlibKt Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' stepIntoStdlib.kt:6 -ArraysKt.!EXT! +_Arrays.!EXT! 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/evaluate/multipleBreakpoints/library/customLibClassName.kt b/idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/library/customLibClassName.kt index 505388bc9d6..3b5ec0a8860 100644 --- a/idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/library/customLibClassName.kt +++ b/idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/library/customLibClassName.kt @@ -1,7 +1,7 @@ package customLibClassName fun main(args: Array) { - customLib.oneFunSameFileName.oneFunSameFileNameFun() + customLib.oneFunSameClassName.oneFunSameFileNameFun() customLib.twoFunDifferentSignature.twoFunDifferentSignatureFun() customLib.property.foo customLib.breakpointOnLocalProperty.breakpointOnLocalPropertyFun() diff --git a/idea/testData/debugger/tinyApp/src/stepping/filters/stepIntoMultiFileFacade.kt b/idea/testData/debugger/tinyApp/src/stepping/filters/stepIntoMultiFileFacade.kt new file mode 100644 index 00000000000..11b48a0c86d --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/filters/stepIntoMultiFileFacade.kt @@ -0,0 +1,9 @@ +package stepIntoMultiFileFacade + +fun main(args: Array) { + //Breakpoint! + customLib.oneFunSameClassName.oneFunSameFileNameFun() +} + +// STEP_INTO: 2 +// TRACING_FILTERS_ENABLED: false \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java index 9cbdde218c7..1a99732d59d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -454,6 +454,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { doStepIntoTest(fileName); } + @TestMetadata("stepIntoMultiFileFacade.kt") + public void testStepIntoMultiFileFacade() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/filters/stepIntoMultiFileFacade.kt"); + doStepIntoTest(fileName); + } + @TestMetadata("stepIntoSpecificKotlinClasses.kt") public void testStepIntoSpecificKotlinClasses() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/filters/stepIntoSpecificKotlinClasses.kt");