diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api index 9790ed05ab..322c60099e 100644 --- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api +++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api @@ -742,12 +742,25 @@ public final class kotlinx/coroutines/channels/ChannelResult { public final synthetic fun unbox-impl ()Ljava/lang/Object; } +public final class kotlinx/coroutines/channels/ChannelResult$Closed : kotlinx/coroutines/channels/ChannelResult$Failed { + public final field cause Ljava/lang/Throwable; + public fun (Ljava/lang/Throwable;)V + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + public final class kotlinx/coroutines/channels/ChannelResult$Companion { public final fun closed-JP2dKIU (Ljava/lang/Throwable;)Ljava/lang/Object; public final fun failure-PtdJZtk ()Ljava/lang/Object; public final fun success-JP2dKIU (Ljava/lang/Object;)Ljava/lang/Object; } +public class kotlinx/coroutines/channels/ChannelResult$Failed { + public fun ()V + public fun toString ()Ljava/lang/String; +} + public final class kotlinx/coroutines/channels/ChannelsKt { public static final synthetic fun any (Lkotlinx/coroutines/channels/ReceiveChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun cancelConsumed (Lkotlinx/coroutines/channels/ReceiveChannel;Ljava/lang/Throwable;)V diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api index effb60f649..b352f412ee 100644 --- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api +++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api @@ -546,6 +546,23 @@ final value class <#A: out kotlin/Any?> kotlinx.coroutines.channels/ChannelResul final fun hashCode(): kotlin/Int // kotlinx.coroutines.channels/ChannelResult.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.toString|toString(){}[0] + final class Closed : kotlinx.coroutines.channels/ChannelResult.Failed { // kotlinx.coroutines.channels/ChannelResult.Closed|null[0] + constructor (kotlin/Throwable?) // kotlinx.coroutines.channels/ChannelResult.Closed.|(kotlin.Throwable?){}[0] + + final val cause // kotlinx.coroutines.channels/ChannelResult.Closed.cause|{}cause[0] + final fun (): kotlin/Throwable? // kotlinx.coroutines.channels/ChannelResult.Closed.cause.|(){}[0] + + final fun equals(kotlin/Any?): kotlin/Boolean // kotlinx.coroutines.channels/ChannelResult.Closed.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // kotlinx.coroutines.channels/ChannelResult.Closed.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.Closed.toString|toString(){}[0] + } + + open class Failed { // kotlinx.coroutines.channels/ChannelResult.Failed|null[0] + constructor () // kotlinx.coroutines.channels/ChannelResult.Failed.|(){}[0] + + open fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.Failed.toString|toString(){}[0] + } + final object Companion { // kotlinx.coroutines.channels/ChannelResult.Companion|null[0] final fun <#A2: kotlin/Any?> closed(kotlin/Throwable?): kotlinx.coroutines.channels/ChannelResult<#A2> // kotlinx.coroutines.channels/ChannelResult.Companion.closed|closed(kotlin.Throwable?){0§}[0] final fun <#A2: kotlin/Any?> failure(): kotlinx.coroutines.channels/ChannelResult<#A2> // kotlinx.coroutines.channels/ChannelResult.Companion.failure|failure(){0§}[0] diff --git a/kotlinx-coroutines-core/common/src/channels/Channel.kt b/kotlinx-coroutines-core/common/src/channels/Channel.kt index 3e3c0f5fae..bf2b5b8bf2 100644 --- a/kotlinx-coroutines-core/common/src/channels/Channel.kt +++ b/kotlinx-coroutines-core/common/src/channels/Channel.kt @@ -939,10 +939,12 @@ public value class ChannelResult */ public fun exceptionOrNull(): Throwable? = (holder as? Closed)?.cause + @PublishedApi // necessary because it's exposed in public inline functions. internal open class Failed { override fun toString(): String = "Failed" } + @PublishedApi // necessary because it's exposed in public inline functions. internal class Closed(@JvmField val cause: Throwable?): Failed() { override fun equals(other: Any?): Boolean = other is Closed && cause == other.cause override fun hashCode(): Int = cause.hashCode() diff --git a/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt b/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt index 8f21b13c25..979d357ee0 100644 --- a/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt +++ b/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt @@ -96,6 +96,7 @@ internal fun restoreThreadContext(context: CoroutineContext, oldState: Any?) { @PublishedApi internal data class ThreadLocalKey(private val threadLocal: ThreadLocal<*>) : CoroutineContext.Key> +@PublishedApi internal class ThreadLocalElement( private val value: T, private val threadLocal: ThreadLocal