From 6752d0f180e0022cc6ef37abe39841a638938c8c Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Wed, 16 Mar 2016 16:49:16 +0300 Subject: [PATCH] Descriptors from library source should be visible from descriptors from libraries class files --- .../kotlin/idea/caches/resolve/IdeaModuleInfos.kt | 4 ++++ .../customLibraryForTinyApp/fileWithInternal.kt | 6 ++++++ .../customLibraryForTinyApp/fileWithInternal2.kt | 3 +++ idea/testData/debugger/tinyApp/outs/fileWithError.out | 8 ++++++++ .../src/evaluate/singleBreakpoint/fileWithError.kt | 11 +++++++++++ .../KotlinEvaluateExpressionTestGenerated.java | 6 ++++++ 6 files changed, 38 insertions(+) create mode 100644 idea/testData/debugger/customLibraryForTinyApp/fileWithInternal.kt create mode 100644 idea/testData/debugger/customLibraryForTinyApp/fileWithInternal2.kt create mode 100644 idea/testData/debugger/tinyApp/outs/fileWithError.out create mode 100644 idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/fileWithError.kt diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfos.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfos.kt index 34080d638d9..74c2e10ea06 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfos.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfos.kt @@ -237,6 +237,10 @@ internal data class LibrarySourceInfo(val project: Project, val library: Library return listOf(this) + LibraryInfo(project, library).dependencies() } + override fun modulesWhoseInternalsAreVisible(): Collection { + return listOf(LibraryInfo(project, library)) + } + override fun toString() = "LibrarySourceInfo(libraryName=${library.name})" } diff --git a/idea/testData/debugger/customLibraryForTinyApp/fileWithInternal.kt b/idea/testData/debugger/customLibraryForTinyApp/fileWithInternal.kt new file mode 100644 index 00000000000..a31184c5053 --- /dev/null +++ b/idea/testData/debugger/customLibraryForTinyApp/fileWithInternal.kt @@ -0,0 +1,6 @@ +package fileWithInternal + +fun test() { + // Breakpoint + val a = fileWithInternal2.MyInternal() +} \ No newline at end of file diff --git a/idea/testData/debugger/customLibraryForTinyApp/fileWithInternal2.kt b/idea/testData/debugger/customLibraryForTinyApp/fileWithInternal2.kt new file mode 100644 index 00000000000..4f6d5943257 --- /dev/null +++ b/idea/testData/debugger/customLibraryForTinyApp/fileWithInternal2.kt @@ -0,0 +1,3 @@ +package fileWithInternal2 + +internal class MyInternal \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/outs/fileWithError.out b/idea/testData/debugger/tinyApp/outs/fileWithError.out new file mode 100644 index 00000000000..eabb8503456 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/fileWithError.out @@ -0,0 +1,8 @@ +LineBreakpoint created at fileWithInternal.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! fileWithError.FileWithErrorKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +fileWithInternal.kt:5 +Compile bytecode for 1 +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/singleBreakpoint/fileWithError.kt b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/fileWithError.kt new file mode 100644 index 00000000000..52a3370def7 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/fileWithError.kt @@ -0,0 +1,11 @@ +package fileWithError + +fun main(args: Array) { + // There is an error about internal visibility while analyzing fileWithInternal.kt + fileWithInternal.test() +} + +// ADDITIONAL_BREAKPOINT: fileWithInternal.kt:Breakpoint + +// EXPRESSION: 1 +// RESULT: 1: I \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java index 73e01175b82..c4f9e5bc9e5 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java @@ -145,6 +145,12 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat doSingleBreakpointTest(fileName); } + @TestMetadata("fileWithError.kt") + public void testFileWithError() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/fileWithError.kt"); + doSingleBreakpointTest(fileName); + } + @TestMetadata("funFromSuperClass.kt") public void testFunFromSuperClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/funFromSuperClass.kt");