diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt index 6d9185c54dc..ad70f9a0726 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt @@ -192,15 +192,15 @@ class KotlinFacetSettings { var targetPlatform: TargetPlatform? = null get() { - // This work-around is required in order to fix importing of the proper JVM target version. + // This work-around is required in order to fix importing of the proper JVM target version and works only + // for fully actualized JVM target platform //TODO(auskov): this hack should be removed after fixing equals in SimplePlatform val args = compilerArguments - val mappedPlatforms = field?.componentPlatforms?.flatMap { - if (JvmPlatforms.defaultJvmPlatform.first() == it && args != null) (IdePlatformKind.platformByCompilerArguments(args) - ?: return null) else listOf(it) - }?.toSet() ?: return null - - return TargetPlatform(mappedPlatforms) + val singleSimplePlatform = field?.componentPlatforms?.singleOrNull() + if (singleSimplePlatform == JvmPlatforms.defaultJvmPlatform.singleOrNull() && args != null) { + return IdePlatformKind.platformByCompilerArguments(args) + } + return field }