diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt
index d9161fe8b635..3787297ae144 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInTempDirTest.kt
@@ -116,6 +116,16 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
Assert.assertEquals(moduleFileContentBefore.replace("platform=\"JVM 1.8\"", "platform=\"JVM 1.8\" allPlatforms=\"JVM [1.8]\""), moduleFileContentAfter)
}
+ fun testLoadAndSaveProjectHMPPFacetConfig() {
+ val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
+ val application = ApplicationManager.getApplication() as ApplicationImpl
+ application.isSaveAllowed = true
+ application.saveAll()
+ val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
+ Assert.assertEquals(moduleFileContentBefore.replace("platform=\"JVM 1.8\"", "platform=\"JVM 1.8\" allPlatforms=\"JVM [1.8]\""), moduleFileContentAfter)
+ }
+
+
fun testApiVersionWithoutLanguageVersion() {
KotlinCommonCompilerArgumentsHolder.getInstance(myProject)
val settings = myProject.getLanguageVersionSettings()
diff --git a/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/module.iml b/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/module.iml
new file mode 100644
index 000000000000..5183ddd11367
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/module.iml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/projectFile.ipr b/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/projectFile.ipr
new file mode 100644
index 000000000000..a1407e2c8cd3
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/projectFile.ipr
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/src/foo.kt b/plugins/kotlin/idea/tests/testData/configuration/loadAndSaveProjectHMPPFacetConfig/src/foo.kt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/plugins/kotlin/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt b/plugins/kotlin/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt
index 479d86a1402b..436b626f6bde 100644
--- a/plugins/kotlin/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt
+++ b/plugins/kotlin/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt
@@ -305,7 +305,7 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
targetPlatform?.let {
element.setAttribute("platform", it.oldFashionedDescription)
- element.setAttribute("allPlatforms", it.componentPlatforms.map { it.serializeToString() }.joinToString(separator = "/"))
+ element.setAttribute("allPlatforms", it.componentPlatforms.map { it.serializeToString() }.sorted().joinToString(separator = "/"))
}
if (!useProjectSettings) {
element.setAttribute("useProjectSettings", useProjectSettings.toString())