From 4d473389a2b7a0005e015ae19e8d78b88f46c0a8 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 3 Apr 2019 14:34:03 +0300 Subject: [PATCH] Remove platform comparisons based on string dictionary order (KT-30356) Comparison was changed in https://github.com/JetBrains/kotlin/commit/fac356c690891236dc7a97d82c2a6a8e1d33bcfd#diff-0895a6eaf69b9fd4d43f83db9889d103R109 #KT-30356 Fixed Original commit: 03c6e234489b419c2b76f974d7badba445d31a03 --- .../jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jps/jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt b/jps/jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt index 88cc0a8724b..94c6d4d4311 100644 --- a/jps/jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt +++ b/jps/jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt @@ -4,8 +4,10 @@ */ @file:JvmName("JvmIdePlatformUtil") + package org.jetbrains.kotlin.platform.impl +import com.intellij.util.text.VersionComparatorUtil import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.config.JvmTarget @@ -18,7 +20,9 @@ object JvmIdePlatformKind : IdePlatformKind() { override fun platformByCompilerArguments(arguments: CommonCompilerArguments): IdePlatform? { return if (arguments is K2JVMCompilerArguments) { val jvmTarget = arguments.jvmTarget ?: JvmTarget.DEFAULT.description - JvmIdePlatformKind.platforms.firstOrNull { it.version.description >= jvmTarget } + platforms.firstOrNull { platform -> + VersionComparatorUtil.COMPARATOR.compare(platform.version.description, jvmTarget) >= 0 + } } else null }