From c9ab4fd21b900f66336d4d029610643c1b8839ae Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Thu, 8 Jul 2021 12:12:48 +0300 Subject: [PATCH] Update Kotlin to 1.5.20 (#2810) --- README.md | 10 +++++----- gradle.properties | 4 ++-- gradle/compile-js-multiplatform.gradle | 2 +- kotlinx-coroutines-core/common/src/Delay.kt | 2 +- .../common/src/channels/ConflatedChannel.kt | 1 + .../common/src/channels/Deprecated.kt | 1 + .../common/src/flow/SharingStarted.kt | 2 +- .../common/src/flow/operators/Lint.kt | 2 +- kotlinx-coroutines-core/jvm/src/channels/Actor.kt | 1 + .../jvm/src/internal/MainDispatchers.kt | 5 ++++- 10 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6844759d8e..16cd49a9d0 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ [![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.5.0)](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.5.0/pom) -[![Kotlin](https://img.shields.io/badge/kotlin-1.5.0-blue.svg?logo=kotlin)](http://kotlinlang.org) +[![Kotlin](https://img.shields.io/badge/kotlin-1.5.20-blue.svg?logo=kotlin)](http://kotlinlang.org) [![Slack channel](https://img.shields.io/badge/chat-slack-green.svg?logo=slack)](https://kotlinlang.slack.com/messages/coroutines/) Library support for Kotlin coroutines with [multiplatform](#multiplatform) support. -This is a companion version for the Kotlin `1.5.0` release. +This is a companion version for the Kotlin `1.5.20` release. ```kotlin suspend fun main() = coroutineScope { @@ -91,7 +91,7 @@ And make sure that you use the latest Kotlin version: ```xml - 1.5.0 + 1.5.20 ``` @@ -109,7 +109,7 @@ And make sure that you use the latest Kotlin version: ```groovy buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.20' } ``` @@ -135,7 +135,7 @@ And make sure that you use the latest Kotlin version: ```groovy plugins { - kotlin("jvm") version "1.5.0" + kotlin("jvm") version "1.5.20" } ``` diff --git a/gradle.properties b/gradle.properties index a6e017787f..c7b9b65d22 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,12 +5,12 @@ # Kotlin version=1.5.0-SNAPSHOT group=org.jetbrains.kotlinx -kotlin_version=1.5.0 +kotlin_version=1.5.20 # Dependencies junit_version=4.12 junit5_version=5.7.0 -atomicfu_version=0.16.1 +atomicfu_version=0.16.2 knit_version=0.3.0-RC html_version=0.7.2 lincheck_version=2.14 diff --git a/gradle/compile-js-multiplatform.gradle b/gradle/compile-js-multiplatform.gradle index 1e885db0c5..d6df7e403a 100644 --- a/gradle/compile-js-multiplatform.gradle +++ b/gradle/compile-js-multiplatform.gradle @@ -46,7 +46,7 @@ compileJsLegacy.configure { kotlinOptions { // drop -js suffix from outputFile def baseName = project.name - "-js" - outputFile = new File(outputFile.parent, baseName + ".js") + outputFile = new File(outputFileProperty.get().parent, baseName + ".js") } } diff --git a/kotlinx-coroutines-core/common/src/Delay.kt b/kotlinx-coroutines-core/common/src/Delay.kt index 53dadf9730..4543c5dda1 100644 --- a/kotlinx-coroutines-core/common/src/Delay.kt +++ b/kotlinx-coroutines-core/common/src/Delay.kt @@ -150,4 +150,4 @@ internal val CoroutineContext.delay: Delay get() = get(ContinuationInterceptor) */ @ExperimentalTime internal fun Duration.toDelayMillis(): Long = - if (this > Duration.ZERO) toLongMilliseconds().coerceAtLeast(1) else 0 + if (this > Duration.ZERO) inWholeMilliseconds.coerceAtLeast(1) else 0 diff --git a/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt b/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt index e1e2b140f5..f7f60cf97d 100644 --- a/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt +++ b/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt @@ -123,6 +123,7 @@ internal open class ConflatedChannel(onUndeliveredElement: OnUndeliveredEleme undeliveredElementException?.let { throw it } // throw UndeliveredElementException at the end if there was one } + @Suppress("UNCHECKED_CAST") private fun updateValueLocked(element: Any?): UndeliveredElementException? { val old = value val undeliveredElementException = if (old === EMPTY) null else diff --git a/kotlinx-coroutines-core/common/src/channels/Deprecated.kt b/kotlinx-coroutines-core/common/src/channels/Deprecated.kt index 963c168c7b..7f1f6efb6e 100644 --- a/kotlinx-coroutines-core/common/src/channels/Deprecated.kt +++ b/kotlinx-coroutines-core/common/src/channels/Deprecated.kt @@ -34,6 +34,7 @@ public suspend fun ReceiveChannel.elementAt(index: Int): E = consume { throw IndexOutOfBoundsException("ReceiveChannel doesn't contain element at index $index.") var count = 0 for (element in this) { + @Suppress("UNUSED_CHANGED_VALUE") // KT-47628 if (index == count++) return element } diff --git a/kotlinx-coroutines-core/common/src/flow/SharingStarted.kt b/kotlinx-coroutines-core/common/src/flow/SharingStarted.kt index ce568fb46d..f4c6f2ee8d 100644 --- a/kotlinx-coroutines-core/common/src/flow/SharingStarted.kt +++ b/kotlinx-coroutines-core/common/src/flow/SharingStarted.kt @@ -140,7 +140,7 @@ public fun SharingStarted.Companion.WhileSubscribed( stopTimeout: Duration = Duration.ZERO, replayExpiration: Duration = Duration.INFINITE ): SharingStarted = - StartedWhileSubscribed(stopTimeout.toLongMilliseconds(), replayExpiration.toLongMilliseconds()) + StartedWhileSubscribed(stopTimeout.inWholeMilliseconds, replayExpiration.inWholeMilliseconds) // -------------------------------- implementation -------------------------------- diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Lint.kt b/kotlinx-coroutines-core/common/src/flow/operators/Lint.kt index 2f7bc358e8..858c885c1e 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Lint.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Lint.kt @@ -2,7 +2,7 @@ * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ -@file:Suppress("unused", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:Suppress("unused", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "UNUSED_PARAMETER") package kotlinx.coroutines.flow diff --git a/kotlinx-coroutines-core/jvm/src/channels/Actor.kt b/kotlinx-coroutines-core/jvm/src/channels/Actor.kt index 5153cb47f1..96cda7b1af 100644 --- a/kotlinx-coroutines-core/jvm/src/channels/Actor.kt +++ b/kotlinx-coroutines-core/jvm/src/channels/Actor.kt @@ -163,6 +163,7 @@ private class LazyActorCoroutine( return super.send(element) } + @Suppress("DEPRECATION_ERROR") override fun offer(element: E): Boolean { start() return super.offer(element) diff --git a/kotlinx-coroutines-core/jvm/src/internal/MainDispatchers.kt b/kotlinx-coroutines-core/jvm/src/internal/MainDispatchers.kt index 3102fdfbb9..2d447413b8 100644 --- a/kotlinx-coroutines-core/jvm/src/internal/MainDispatchers.kt +++ b/kotlinx-coroutines-core/jvm/src/internal/MainDispatchers.kt @@ -67,7 +67,10 @@ public fun MainCoroutineDispatcher.isMissing(): Boolean = this is MissingMainCor @Suppress("MayBeConstant") private val SUPPORT_MISSING = true -@Suppress("ConstantConditionIf") +@Suppress( + "ConstantConditionIf", + "IMPLICIT_NOTHING_TYPE_ARGUMENT_AGAINST_NOT_NOTHING_EXPECTED_TYPE" // KT-47626 +) private fun createMissingDispatcher(cause: Throwable? = null, errorHint: String? = null) = if (SUPPORT_MISSING) MissingMainCoroutineDispatcher(cause, errorHint) else cause?.let { throw it } ?: throwMissingMainDispatcherException()