Skip to content

Fix compilation after KT-76478 #4442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init> (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 <init> ()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
Expand Down
17 changes: 17 additions & 0 deletions kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init>(kotlin/Throwable?) // kotlinx.coroutines.channels/ChannelResult.Closed.<init>|<init>(kotlin.Throwable?){}[0]

final val cause // kotlinx.coroutines.channels/ChannelResult.Closed.cause|{}cause[0]
final fun <get-cause>(): kotlin/Throwable? // kotlinx.coroutines.channels/ChannelResult.Closed.cause.<get-cause>|<get-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 <init>() // kotlinx.coroutines.channels/ChannelResult.Failed.<init>|<init>(){}[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§<kotlin.Any?>}[0]
final fun <#A2: kotlin/Any?> failure(): kotlinx.coroutines.channels/ChannelResult<#A2> // kotlinx.coroutines.channels/ChannelResult.Companion.failure|failure(){0§<kotlin.Any?>}[0]
Expand Down
2 changes: 2 additions & 0 deletions kotlinx-coroutines-core/common/src/channels/Channel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -939,10 +939,12 @@ public value class ChannelResult<out T>
*/
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()
Expand Down
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ internal fun restoreThreadContext(context: CoroutineContext, oldState: Any?) {
@PublishedApi
internal data class ThreadLocalKey(private val threadLocal: ThreadLocal<*>) : CoroutineContext.Key<ThreadLocalElement<*>>

@PublishedApi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I wonder why this does not appear in the API dump.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fzhinkin, do you have an idea?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkhalanskyjb that's because the internal package is explicitly excluded from dumps:

ignoredPackages += "kotlinx.coroutines.internal"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I didn't realize that was a thing. I think it's a mistake to exclude anything from the API dump at this point, but that's beyond the scope of this PR.

internal class ThreadLocalElement<T>(
private val value: T,
private val threadLocal: ThreadLocal<T>
Expand Down