From 4755cab74047608f0df917d7bbe14798fbf355be Mon Sep 17 00:00:00 2001 From: Michael Nedzelsky Date: Sun, 27 Sep 2015 00:17:19 +0300 Subject: [PATCH] fix check for internal from another module in imports and file level annotations Original commit: 0035bbba7c28cb0de2e0d159f659291b05c9c79b --- .../org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt | 4 +++- .../testData/general/InternalFromAnotherModule/errors.txt | 7 ++++--- .../InternalFromAnotherModule/module2/src/module2.kt | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt b/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt index e43df4eb49e..0bcb5bc3135 100644 --- a/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt +++ b/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt @@ -36,6 +36,7 @@ import org.jetbrains.jps.builders.logging.BuildLoggingManager import org.jetbrains.jps.incremental.BuilderRegistry import org.jetbrains.jps.incremental.IncProjectBuilder import org.jetbrains.jps.incremental.messages.BuildMessage +import org.jetbrains.jps.incremental.messages.CompilerMessage import org.jetbrains.jps.model.java.JpsJavaDependencyScope import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.jps.model.module.JpsModule @@ -480,7 +481,8 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() { result.assertFailed() val actualErrors = result.getMessages(BuildMessage.Kind.ERROR) - .map { it.messageText }.sorted().joinToString("\n") + .map { it as CompilerMessage } + .map { "${it.messageText} at line ${it.line}, column ${it.column}" }.sorted().joinToString("\n") val projectRoot = File(AbstractKotlinJpsBuildTestCase.TEST_DATA_PATH + "general/" + getTestName(false)) val expectedFile = File(projectRoot, "errors.txt") JetTestUtils.assertEqualsToFile(expectedFile, actualErrors) diff --git a/jps/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt b/jps/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt index b1533fc68e8..13cd0c3cbf1 100644 --- a/jps/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt +++ b/jps/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt @@ -1,3 +1,4 @@ -'internal open val member: kotlin.Int defined in test.ClassBB1' has no access to 'internal abstract val member: kotlin.Int defined in test.ClassB1', so it cannot override it -Cannot access 'InternalClass1': it is 'internal' in 'test' -Cannot access 'member': it is 'invisible_fake' in 'ClassAA1' \ No newline at end of file +'internal open val member: kotlin.Int defined in test.ClassBB1' has no access to 'internal abstract val member: kotlin.Int defined in test.ClassB1', so it cannot override it at line 11, column 14 +Cannot access 'InternalClass1': it is 'internal' in 'test' at line 3, column 13 +Cannot access 'InternalClass1': it is 'internal' in 'test' at line 6, column 36 +Cannot access 'member': it is 'invisible_fake' in 'ClassAA1' at line 24, column 25 \ No newline at end of file diff --git a/jps/jps-plugin/testData/general/InternalFromAnotherModule/module2/src/module2.kt b/jps/jps-plugin/testData/general/InternalFromAnotherModule/module2/src/module2.kt index e4e4077a9f4..64f4bb6cf1f 100644 --- a/jps/jps-plugin/testData/general/InternalFromAnotherModule/module2/src/module2.kt +++ b/jps/jps-plugin/testData/general/InternalFromAnotherModule/module2/src/module2.kt @@ -1,5 +1,7 @@ package test +import test.InternalClass1 + // InternalClass1, ClassA1, ClassB1 are in module1 class ClassInheritedFromInternal1: InternalClass1()