diff --git a/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt b/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt index 7412c7a016f..9c1b72ea49d 100644 --- a/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt +++ b/jps/jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt @@ -107,8 +107,7 @@ private fun readV1Config(element: Element): KotlinFacetSettings { // TODO: Introduce new version of facet serialization. See https://youtrack.jetbrains.com/issue/KT-38235 // This is necessary to avoid having too much custom logic for platform serialization. fun Element.getFacetPlatformByConfigurationElement(): TargetPlatform { - val targetPlatform = getAttributeValue("allPlatforms").deserializeTargetPlatformByComponentPlatforms() - if (targetPlatform != null) return targetPlatform + getAttributeValue("allPlatforms").deserializeTargetPlatformByComponentPlatforms()?.let { return it } // failed to read list of all platforms. Fallback to legacy algorithm val platformName = getAttributeValue("platform") ?: return DefaultIdeTargetPlatformKindProvider.defaultPlatform @@ -422,9 +421,7 @@ private fun TargetPlatform.serializeComponentPlatforms(): String { } private fun String?.deserializeTargetPlatformByComponentPlatforms(): TargetPlatform? { - val componentPlatformNames = this?.split('/')?.toSet() - if (componentPlatformNames == null || componentPlatformNames.isEmpty()) - return null + val componentPlatformNames = this?.split('/')?.toSet()?.takeIf { it.isNotEmpty() } ?: return null val knownComponentPlatforms = HashMap() // "serialization presentation" to "simple platform name"