diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinFoldingBuilder.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinFoldingBuilder.kt index 18c8e8e5492..6f1c26096dd 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinFoldingBuilder.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinFoldingBuilder.kt @@ -173,7 +173,7 @@ class KotlinFoldingBuilder : CustomFoldingBuilder(), DumbAware { private fun String.addSpaceIfNeeded(): String { if (isEmpty() || endsWith(" ")) return this - return this + " " + return "$this " } private fun getFirstLineOfComment(node: ASTNode): String { diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginCompatibilityVerifier.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginCompatibilityVerifier.kt index 547d42f13fc..573081df9c7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginCompatibilityVerifier.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginCompatibilityVerifier.kt @@ -34,7 +34,7 @@ internal data class KotlinPluginVersion( val patchNumber: String // usually '1' ) { companion object { - private val KOTLIN_VERSION_REGEX = "^([\\d\\.]+)\\-([A-Za-z]+)\\-(\\d+)\\-([A-Za-z0-9\\.]+)\\-(\\d+)$".toRegex() + private val KOTLIN_VERSION_REGEX = "^([\\d.]+)-([A-Za-z]+)-(\\d+)-([A-Za-z0-9.]+)-(\\d+)$".toRegex() fun parse(version: String): KotlinPluginVersion? { val matchResult = KOTLIN_VERSION_REGEX.matchEntire(version) ?: return null diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt index a2dc0fa19c7..d9346e1eccb 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt @@ -84,7 +84,7 @@ sealed class PluginUpdateStatus { } } -class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Disposable { +class KotlinPluginUpdater(private val propertiesComponent: PropertiesComponent) : Disposable { private var updateDelay = INITIAL_UPDATE_DELAY private val alarm = Alarm(Alarm.ThreadToUse.POOLED_THREAD, this) private val notificationGroup = NotificationGroup("Kotlin plugin updates", NotificationDisplayType.STICKY_BALLOON, true) @@ -200,12 +200,10 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos return PluginUpdateStatus.LatestVersionInstalled } val newVersion = responseDoc.getChild("category")?.getChild("idea-plugin")?.getChild("version")?.text - if (newVersion == null) { - return PluginUpdateStatus.CheckFailed( + ?: return PluginUpdateStatus.CheckFailed( "Couldn't find plugin version in repository response", JDOMUtil.writeElement(responseDoc, "\n") ) - } val pluginDescriptor = initPluginDescriptor(newVersion) return updateIfNotLatest(pluginDescriptor, null) } @@ -274,6 +272,8 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos if (prepareResult) { val pluginDescriptor = pluginDownloader.descriptor + // BUNCH: 181 Not null since 182. + @Suppress("SENSELESS_COMPARISON") if (pluginDescriptor != null) { installed = true pluginDownloader.install()