diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt index 3f69c28f4cd..024e486c2bb 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,7 @@ import org.jetbrains.org.objectweb.asm.MethodVisitor import org.jetbrains.org.objectweb.asm.Opcodes import org.junit.Assert import java.io.* +import java.net.URLClassLoader import java.util.* import java.util.regex.Pattern import java.util.zip.ZipOutputStream @@ -532,6 +533,15 @@ class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() { result.checkErrors() } + fun testInternalFromSpecialRelatedModule() { + initProject() + makeAll().assertSuccessful() + + val classpath = listOf("out/production/module1", "out/test/module2").map { File(workDir, it).toURI().toURL() }.toTypedArray() + val clazz = URLClassLoader(classpath).loadClass("test2.BarKt") + clazz.getMethod("box").invoke(null) + } + fun testCircularDependenciesInternalFromAnotherModule() { initProject() val result = makeAll() diff --git a/jps-plugin/testData/general/InternalFromSpecialRelatedModule/kotlinProject.ipr b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/kotlinProject.ipr new file mode 100644 index 00000000000..c1a403dd047 --- /dev/null +++ b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/kotlinProject.ipr @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/module1.iml b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/module1.iml new file mode 100644 index 00000000000..3b1ba79ed61 --- /dev/null +++ b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/module1.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/src/foo.kt b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/src/foo.kt new file mode 100644 index 00000000000..05a686274b7 --- /dev/null +++ b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module1/src/foo.kt @@ -0,0 +1,23 @@ +package test1 + +@Target(AnnotationTarget.FILE) +@Retention(AnnotationRetention.SOURCE) +internal annotation class InternalFileAnnotation1() + +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.SOURCE) +internal annotation class InternalClassAnnotation1() + +internal open class InternalClass1 + +abstract class ClassA1(internal val member: Int) + +abstract class ClassB1 { + internal abstract val member: Int + internal fun func() = 1 +} + +internal val internalProp = 1 + +internal fun internalFun() {} + diff --git a/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/module2.iml b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/module2.iml new file mode 100644 index 00000000000..427f7bce96f --- /dev/null +++ b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/module2.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/test/bar.kt b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/test/bar.kt new file mode 100644 index 00000000000..773dbd3ef8e --- /dev/null +++ b/jps-plugin/testData/general/InternalFromSpecialRelatedModule/module2/test/bar.kt @@ -0,0 +1,26 @@ +// TODO uncomment annotations when KT-12199 will be fixed + +//@file:InternalFileAnnotation1 + +package test2 + +import test1.* + +internal class FromInternalClass1: InternalClass1() + +//@InternalClassAnnotation +class FromClassA1 : ClassA1(10) + +class FromClassB1 : ClassB1() { + internal override val member = 10 +} + +fun box() { + internalProp + internalFun() + + InternalClass1() + FromClassA1().member + FromClassB1().member + FromClassB1().func() +}