From 6bedbfb67fefd8d44514418b266a59330cafccca Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 10 Apr 2017 20:00:45 +0300 Subject: [PATCH] Add tests for KT-12199 to prevent regression #KT-12199 Obsolete Original commit: 712b2c81174de50b8ce98a565da45116bf7ee953 --- .../src/src.kt | 14 ++++++++++- .../test/test.kt | 23 ++++++++++++++++++- .../module1/src/foo.kt | 4 ++++ .../module2/test/bar.kt | 17 ++++++++++---- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/src/src.kt b/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/src/src.kt index f820de4b762..a35e5b25181 100644 --- a/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/src/src.kt +++ b/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/src/src.kt @@ -1,3 +1,15 @@ fun foo() { } -internal fun internalBar() {} \ No newline at end of file +internal fun internalBar() {} + +@Target(AnnotationTarget.FILE) +@Retention(AnnotationRetention.SOURCE) +internal annotation class InternalFileAnnotation() + +@Target(AnnotationTarget.FUNCTION) +@Retention(AnnotationRetention.SOURCE) +internal annotation class InternalFunctionAnnotation() + +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.SOURCE) +internal annotation class InternalClassAnnotation() diff --git a/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/test/test.kt b/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/test/test.kt index 1249dfa8d90..9d74548c058 100644 --- a/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/test/test.kt +++ b/jps/jps-plugin/testData/general/AccessToInternalInProductionFromTests/test/test.kt @@ -1,4 +1,25 @@ +@file:InternalFileAnnotation + +@InternalFunctionAnnotation fun test() { foo() internalBar() -} \ No newline at end of file + + @InternalClassAnnotation + class Local { + @InternalFunctionAnnotation + fun foo() {} + } +} + +@InternalClassAnnotation +class Class { + @InternalFunctionAnnotation + fun foo() {} + + @InternalClassAnnotation + class Nested { + @InternalFunctionAnnotation + fun foo() {} + } +} diff --git a/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/src/foo.kt b/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/src/foo.kt index 05a686274b7..830308321e1 100644 --- a/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/src/foo.kt +++ b/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/src/foo.kt @@ -8,6 +8,10 @@ internal annotation class InternalFileAnnotation1() @Retention(AnnotationRetention.SOURCE) internal annotation class InternalClassAnnotation1() +@Target(AnnotationTarget.FUNCTION) +@Retention(AnnotationRetention.SOURCE) +internal annotation class InternalFunctionAnnotation1() + internal open class InternalClass1 abstract class ClassA1(internal val member: Int) diff --git a/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/test/bar.kt b/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/test/bar.kt index 773dbd3ef8e..22519ed79af 100644 --- a/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/test/bar.kt +++ b/jps/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/test/bar.kt @@ -1,6 +1,4 @@ -// TODO uncomment annotations when KT-12199 will be fixed - -//@file:InternalFileAnnotation1 +@file:InternalFileAnnotation1 package test2 @@ -8,13 +6,22 @@ import test1.* internal class FromInternalClass1: InternalClass1() -//@InternalClassAnnotation -class FromClassA1 : ClassA1(10) +@InternalClassAnnotation1 +class FromClassA1 : ClassA1(10) { + @InternalClassAnnotation1 + class Nested { + @InternalFunctionAnnotation1 + fun foo() {} + } +} class FromClassB1 : ClassB1() { internal override val member = 10 } +@InternalFunctionAnnotation1 +fun foo() {} + fun box() { internalProp internalFun()