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 f8d4f8cec66..3b31cf01de5 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
@@ -225,6 +225,19 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
checkWhen(touch("src/test1.kt"), null, packageClasses("kotlinProject", "src/test1.kt", "Test1Kt"))
}
+ public fun testSourcePackagePrefix() {
+ doTest()
+ }
+
+ public fun testSourcePackageLongPrefix() {
+ initProject()
+ val buildResult = makeAll()
+ buildResult.assertSuccessful()
+ val warnings = buildResult.getMessages(BuildMessage.Kind.WARNING)
+ assertEquals("Warning about invalid package prefix in module 2 is expected: $warnings", 2, warnings.size)
+ assertEquals("Invalid package prefix name is ignored: invalid-prefix.test", warnings.first().messageText)
+ }
+
public fun testKotlinJavaScriptProject() {
initProject()
addKotlinJavaScriptStdlibDependency()
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/kotlinProject.ipr b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/kotlinProject.ipr
new file mode 100644
index 00000000000..c1a403dd047
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/kotlinProject.ipr
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/module1.iml b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/module1.iml
new file mode 100644
index 00000000000..0e80071dec9
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/module1.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/JavaDependency.java b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/JavaDependency.java
new file mode 100644
index 00000000000..a62f5d9cb15
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/JavaDependency.java
@@ -0,0 +1,6 @@
+package good.prefix;
+
+public class JavaDependency {
+ public void bar() {}
+}
+
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/JavaTest.java b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/JavaTest.java
new file mode 100644
index 00000000000..3274d3549d7
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/JavaTest.java
@@ -0,0 +1,6 @@
+package good.prefix;
+
+public class JavaTest extends JavaDependency {
+
+}
+
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/inBadPrefix.kt b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/inBadPrefix.kt
new file mode 100644
index 00000000000..609e07b4c73
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/inBadPrefix.kt
@@ -0,0 +1,4 @@
+package bad.prefix
+
+class KotlinTestInBadPrefix
+
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/isGoodPrefix.kt b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/isGoodPrefix.kt
new file mode 100644
index 00000000000..90c847137fa
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/isGoodPrefix.kt
@@ -0,0 +1,3 @@
+package good.prefix
+
+class KotlinTestInGoodPrefix
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/test/other/otherTest.kt b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/test/other/otherTest.kt
new file mode 100644
index 00000000000..d27a3ac6bf5
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module1/src/test/other/otherTest.kt
@@ -0,0 +1,9 @@
+package test.other
+
+import bad.prefix.KotlinTestInBadPrefix
+import good.prefix.KotlinTestInGoodPrefix
+import good.prefix.JavaTest;
+
+val goodTest = KotlinTestInGoodPrefix()
+val badTest = KotlinTestInBadPrefix()
+val javaTest = JavaTest().bar()
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/module2.iml b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/module2.iml
new file mode 100644
index 00000000000..5517bfe3dd6
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/module2.iml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/src/module2.kt b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/src/module2.kt
new file mode 100644
index 00000000000..9204cc97b43
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/src/module2.kt
@@ -0,0 +1,13 @@
+package some
+
+import bad.prefix.KotlinTestInBadPrefix
+import good.prefix.KotlinTestInGoodPrefix
+import good.prefix.JavaTest;
+import test.JavaRef
+
+val goodTest = KotlinTestInGoodPrefix()
+val badTest = KotlinTestInBadPrefix()
+val javaTest = JavaTest().bar()
+val javaRef = JavaRef().foo(null)
+
+
diff --git a/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/src/test/JavaRef.java b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/src/test/JavaRef.java
new file mode 100644
index 00000000000..cecb63b8131
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackageLongPrefix/module2/src/test/JavaRef.java
@@ -0,0 +1,9 @@
+package test;
+
+import good.prefix.JavaTest;
+
+public class JavaRef {
+ public void foo(JavaTest javaTest) {
+
+ }
+}
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/SourcePackagePrefix/kotlinProject.iml b/jps/jps-plugin/testData/general/SourcePackagePrefix/kotlinProject.iml
new file mode 100644
index 00000000000..cbc89b8246b
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackagePrefix/kotlinProject.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/jps-plugin/testData/general/SourcePackagePrefix/kotlinProject.ipr b/jps/jps-plugin/testData/general/SourcePackagePrefix/kotlinProject.ipr
new file mode 100644
index 00000000000..90747786771
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackagePrefix/kotlinProject.ipr
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/SourcePackagePrefix/src/OtherJava.java b/jps/jps-plugin/testData/general/SourcePackagePrefix/src/OtherJava.java
new file mode 100644
index 00000000000..0bb1d196b40
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackagePrefix/src/OtherJava.java
@@ -0,0 +1,4 @@
+package xxx;
+
+public class OtherJava {
+}
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/SourcePackagePrefix/src/Test.java b/jps/jps-plugin/testData/general/SourcePackagePrefix/src/Test.java
new file mode 100644
index 00000000000..7588040949b
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackagePrefix/src/Test.java
@@ -0,0 +1,7 @@
+package xxx;
+
+public class Test {
+ String test(OtherJava otherJava) {
+ return "";
+ }
+}
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/SourcePackagePrefix/src/test.kt b/jps/jps-plugin/testData/general/SourcePackagePrefix/src/test.kt
new file mode 100644
index 00000000000..1059b01fe47
--- /dev/null
+++ b/jps/jps-plugin/testData/general/SourcePackagePrefix/src/test.kt
@@ -0,0 +1,3 @@
+package xxx
+
+val test = Test().test(null)
\ No newline at end of file