Add test for KT-14751

This commit is contained in:
Dmitry Jemerov
2016-11-11 13:28:38 +01:00
parent 13a17b8bd7
commit 978b70e50b
5 changed files with 54 additions and 4 deletions
@@ -186,10 +186,14 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() {
private fun adaptJavaSource(text: String): String {
val typeAnnotations = arrayOf("NotNull", "Nullable", "ReadOnly", "Mutable")
return typeAnnotations.fold(text) { text, annotation -> text.replace("@$annotation", "") }.replace(
"@interface",
"@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @interface"
)
val adaptedSource = typeAnnotations.fold(text) { text, annotation -> text.replace("@$annotation", "") }
if ("@Retention" !in adaptedSource) {
return adaptedSource.replace(
"@interface",
"@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @interface"
)
}
return adaptedSource
}
private class SyntheticPackageViewForTest(override val module: ModuleDescriptor,