Skip to content
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

Backport: MPP No Trace #2869

Merged
merged 1 commit into from
Dec 12, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion arrow-libs/core/arrow-core/api/arrow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -2592,6 +2592,11 @@ public final class arrow/core/continuations/AtomicRefKt {
public static final fun updateAndGet (Ljava/util/concurrent/atomic/AtomicReference;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
}

public class arrow/core/continuations/CancellationExceptionNoTrace : java/util/concurrent/CancellationException {
public fun <init> ()V
public fun fillInStackTrace ()Ljava/lang/Throwable;
}

public final class arrow/core/continuations/Eager : arrow/core/continuations/ShiftCancellationException {
public fun <init> (Larrow/core/continuations/Token;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)V
public final fun getRecover ()Lkotlin/jvm/functions/Function1;
Expand Down Expand Up @@ -3015,7 +3020,7 @@ public final class arrow/core/continuations/ResultKt {
public static final fun toResult (Larrow/core/continuations/Effect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public abstract class arrow/core/continuations/ShiftCancellationException : java/util/concurrent/CancellationException {
public abstract class arrow/core/continuations/ShiftCancellationException : arrow/core/continuations/CancellationExceptionNoTrace {
}

public final class arrow/core/continuations/Suspend : arrow/core/continuations/ShiftCancellationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,9 @@ public interface Effect<out R, out A> {
* code, you can use this type to differentiate between a foreign [CancellationException] and the
* one from [Effect].
*/
public sealed class ShiftCancellationException : CancellationException("Shifted Continuation")
public sealed class ShiftCancellationException : CancellationExceptionNoTrace()

public expect open class CancellationExceptionNoTrace() : CancellationException

/**
* Holds `R` and `suspend (R) -> B`, the exception that wins the race, will get to execute
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package arrow.core.continuations

import kotlin.coroutines.cancellation.CancellationException

public actual open class CancellationExceptionNoTrace : CancellationException("Shifted Continuation")
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package arrow.core.continuations

import kotlin.coroutines.cancellation.CancellationException

/*
* Inspired by KotlinX Coroutines:
* https://github.com/Kotlin/kotlinx.coroutines/blob/3788889ddfd2bcfedbff1bbca10ee56039e024a2/kotlinx-coroutines-core/jvm/src/Exceptions.kt#L29
*/
public actual open class CancellationExceptionNoTrace : CancellationException("Shifted Continuation") {
override fun fillInStackTrace(): Throwable {
// Prevent Android <= 6.0 bug.
stackTrace = emptyArray()
// We don't need stacktrace on shift, it hurts performance.
return this
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package arrow.core.continuations

import kotlin.coroutines.cancellation.CancellationException

public actual open class CancellationExceptionNoTrace : CancellationException("Shifted Continuation")