Skip to content

Commit e62f8f7

Browse files
authored
Migration to Kotlin 1.5.0-RC (#2653)
* Migrate inline classes to value classes * Adjust debugger/state recovery for new codegen * Temporarily disable R8 tests * Update webpack for new K/JS
1 parent 7872f8f commit e62f8f7

File tree

16 files changed

+59
-68
lines changed

16 files changed

+59
-68
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Kotlin
66
version=1.4.3-SNAPSHOT
77
group=org.jetbrains.kotlinx
8-
kotlin_version=1.4.30
8+
kotlin_version=1.5.0-RC
99

1010
# Dependencies
1111
junit_version=4.12

integration/kotlinx-coroutines-slf4j/api/kotlinx-coroutines-slf4j.api

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ public final class kotlinx/coroutines/slf4j/MDCContext : kotlin/coroutines/Abstr
33
public fun <init> ()V
44
public fun <init> (Ljava/util/Map;)V
55
public synthetic fun <init> (Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6-
public fun fold (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
7-
public fun get (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element;
86
public final fun getContextMap ()Ljava/util/Map;
9-
public fun minusKey (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext;
10-
public fun plus (Lkotlin/coroutines/CoroutineContext;)Lkotlin/coroutines/CoroutineContext;
117
public synthetic fun restoreThreadContext (Lkotlin/coroutines/CoroutineContext;Ljava/lang/Object;)V
128
public fun restoreThreadContext (Lkotlin/coroutines/CoroutineContext;Ljava/util/Map;)V
139
public synthetic fun updateThreadContext (Lkotlin/coroutines/CoroutineContext;)Ljava/lang/Object;

js/example-frontend-js/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ kotlin {
2323

2424
dependencies {
2525
implementation("org.jetbrains.kotlinx:kotlinx-html-js:${version("html")}")
26-
implementation(devNpm("html-webpack-plugin", "3.2.0"))
26+
implementation(devNpm("html-webpack-plugin", "5.3.1"))
2727
}

kotlinx-coroutines-core/api/kotlinx-coroutines-core.api

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public final class kotlinx/coroutines/Delay$DefaultImpls {
267267
public final class kotlinx/coroutines/DelayKt {
268268
public static final fun awaitCancellation (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
269269
public static final fun delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
270-
public static final fun delay-VtjQ1oo (DLkotlin/coroutines/Continuation;)Ljava/lang/Object;
270+
public static final fun delay-VtjQ1oo (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
271271
}
272272

273273
public final class kotlinx/coroutines/Dispatchers {
@@ -535,9 +535,9 @@ public final class kotlinx/coroutines/TimeoutCancellationException : java/util/c
535535

536536
public final class kotlinx/coroutines/TimeoutKt {
537537
public static final fun withTimeout (JLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
538-
public static final fun withTimeout-KLykuaI (DLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
538+
public static final fun withTimeout-KLykuaI (JLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
539539
public static final fun withTimeoutOrNull (JLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
540-
public static final fun withTimeoutOrNull-KLykuaI (DLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
540+
public static final fun withTimeoutOrNull-KLykuaI (JLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
541541
}
542542

543543
public final class kotlinx/coroutines/YieldKt {
@@ -920,7 +920,7 @@ public final class kotlinx/coroutines/flow/FlowKt {
920920
public static final fun count (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
921921
public static final fun debounce (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
922922
public static final fun debounce (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/flow/Flow;
923-
public static final fun debounce-HG0u8IE (Lkotlinx/coroutines/flow/Flow;D)Lkotlinx/coroutines/flow/Flow;
923+
public static final fun debounce-HG0u8IE (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
924924
public static final fun debounceDuration (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/flow/Flow;
925925
public static final fun delayEach (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
926926
public static final fun delayFlow (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
@@ -997,7 +997,7 @@ public final class kotlinx/coroutines/flow/FlowKt {
997997
public static final fun runningFold (Lkotlinx/coroutines/flow/Flow;Ljava/lang/Object;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
998998
public static final fun runningReduce (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
999999
public static final fun sample (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
1000-
public static final fun sample-HG0u8IE (Lkotlinx/coroutines/flow/Flow;D)Lkotlinx/coroutines/flow/Flow;
1000+
public static final fun sample-HG0u8IE (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
10011001
public static final fun scan (Lkotlinx/coroutines/flow/Flow;Ljava/lang/Object;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
10021002
public static final fun scanFold (Lkotlinx/coroutines/flow/Flow;Ljava/lang/Object;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
10031003
public static final fun scanReduce (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
@@ -1084,8 +1084,8 @@ public final class kotlinx/coroutines/flow/SharingStarted$Companion {
10841084
}
10851085

10861086
public final class kotlinx/coroutines/flow/SharingStartedKt {
1087-
public static final fun WhileSubscribed-5qebJ5I (Lkotlinx/coroutines/flow/SharingStarted$Companion;DD)Lkotlinx/coroutines/flow/SharingStarted;
1088-
public static synthetic fun WhileSubscribed-5qebJ5I$default (Lkotlinx/coroutines/flow/SharingStarted$Companion;DDILjava/lang/Object;)Lkotlinx/coroutines/flow/SharingStarted;
1087+
public static final fun WhileSubscribed-5qebJ5I (Lkotlinx/coroutines/flow/SharingStarted$Companion;JJ)Lkotlinx/coroutines/flow/SharingStarted;
1088+
public static synthetic fun WhileSubscribed-5qebJ5I$default (Lkotlinx/coroutines/flow/SharingStarted$Companion;JJILjava/lang/Object;)Lkotlinx/coroutines/flow/SharingStarted;
10891089
}
10901090

10911091
public abstract interface class kotlinx/coroutines/flow/StateFlow : kotlinx/coroutines/flow/SharedFlow {
@@ -1215,7 +1215,7 @@ public abstract interface class kotlinx/coroutines/selects/SelectInstance {
12151215
}
12161216

12171217
public final class kotlinx/coroutines/selects/SelectKt {
1218-
public static final fun onTimeout-8Mi8wO0 (Lkotlinx/coroutines/selects/SelectBuilder;DLkotlin/jvm/functions/Function1;)V
1218+
public static final fun onTimeout-8Mi8wO0 (Lkotlinx/coroutines/selects/SelectBuilder;JLkotlin/jvm/functions/Function1;)V
12191219
public static final fun select (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
12201220
}
12211221

kotlinx-coroutines-core/common/src/channels/Channel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ public interface ReceiveChannel<out E> {
363363
*
364364
* The closed result represents an operation attempt to a closed channel and also implies that the operation has failed.
365365
*/
366-
@Suppress("UNCHECKED_CAST")
367-
public inline class ChannelResult<out T>
366+
@JvmInline
367+
public value class ChannelResult<out T>
368368
@PublishedApi internal constructor(@PublishedApi internal val holder: Any?) {
369369
/**
370370
* Returns `true` if this instance represents a successful
Binary file not shown.

kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,14 @@ internal object DebugProbesImpl {
281281
it.fileName == "ContinuationImpl.kt"
282282
}
283283

284-
val (continuationStartFrame, frameSkipped) = findContinuationStartIndex(
284+
val (continuationStartFrame, delta) = findContinuationStartIndex(
285285
indexOfResumeWith,
286286
actualTrace,
287287
coroutineTrace
288288
)
289289

290290
if (continuationStartFrame == -1) return coroutineTrace
291291

292-
val delta = if (frameSkipped) 1 else 0
293292
val expectedSize = indexOfResumeWith + coroutineTrace.size - continuationStartFrame - 1 - delta
294293
val result = ArrayList<StackTraceElement>(expectedSize)
295294
for (index in 0 until indexOfResumeWith - delta) {
@@ -311,16 +310,22 @@ internal object DebugProbesImpl {
311310
* If method above `resumeWith` has no line number (thus it is `stateMachine.invokeSuspend`),
312311
* it's skipped and attempt to match next one is made because state machine could have been missing in the original coroutine stacktrace.
313312
*
314-
* Returns index of such frame (or -1) and flag indicating whether frame with state machine was skipped
313+
* Returns index of such frame (or -1) and number of skipped frames (up to 2, for state machine and for access$).
315314
*/
316315
private fun findContinuationStartIndex(
317316
indexOfResumeWith: Int,
318317
actualTrace: Array<StackTraceElement>,
319318
coroutineTrace: List<StackTraceElement>
320-
): Pair<Int, Boolean> {
321-
val result = findIndexOfFrame(indexOfResumeWith - 1, actualTrace, coroutineTrace)
322-
if (result == -1) return findIndexOfFrame(indexOfResumeWith - 2, actualTrace, coroutineTrace) to true
323-
return result to false
319+
): Pair<Int, Int> {
320+
/*
321+
* Since Kotlin 1.5.0 we have these access$ methods that we have to skip.
322+
* So we have to test next frame for invokeSuspend, for $access and for actual suspending call.
323+
*/
324+
repeat(3) {
325+
val result = findIndexOfFrame(indexOfResumeWith - 1 - it, actualTrace, coroutineTrace)
326+
if (result != -1) return result to it
327+
}
328+
return -1 to 0
324329
}
325330

326331
private fun findIndexOfFrame(
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kotlinx.coroutines.RecoverableTestException
2-
at kotlinx.coroutines.exceptions.StackTraceRecoverySelectTest$doSelect$$inlined$select$lambda$1.invokeSuspend(StackTraceRecoverySelectTest.kt:33)
2+
at kotlinx.coroutines.exceptions.StackTraceRecoverySelectTest$doSelect$2$1.invokeSuspend(StackTraceRecoverySelectTest.kt)
33
at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt)
4-
at kotlinx.coroutines.exceptions.StackTraceRecoverySelectTest$testSelectJoin$1.invokeSuspend(StackTraceRecoverySelectTest.kt:20)
4+
at kotlinx.coroutines.exceptions.StackTraceRecoverySelectTest$testSelectJoin$1.invokeSuspend(StackTraceRecoverySelectTest.kt)
55
Caused by: kotlinx.coroutines.RecoverableTestException
6-
at kotlinx.coroutines.exceptions.StackTraceRecoverySelectTest$doSelect$$inlined$select$lambda$1.invokeSuspend(StackTraceRecoverySelectTest.kt:33)
7-
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
6+
at kotlinx.coroutines.exceptions.StackTraceRecoverySelectTest$doSelect$2$1.invokeSuspend(StackTraceRecoverySelectTest.kt)
7+
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt)

kotlinx-coroutines-core/jvm/test/exceptions/StackTraceRecoveryNestedScopesTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class StackTraceRecoveryNestedScopesTest : TestBase() {
8686
"\tat kotlinx.coroutines.exceptions.StackTraceRecoveryNestedScopesTest\$callWithTimeout\$2.invokeSuspend(StackTraceRecoveryNestedScopesTest.kt:37)\n" +
8787
"\tat kotlinx.coroutines.exceptions.StackTraceRecoveryNestedScopesTest\$callCoroutineScope\$2.invokeSuspend(StackTraceRecoveryNestedScopesTest.kt:43)\n" +
8888
"\tat kotlinx.coroutines.exceptions.StackTraceRecoveryNestedScopesTest\$testAwaitNestedScopes\$1\$deferred\$1.invokeSuspend(StackTraceRecoveryNestedScopesTest.kt:68)\n" +
89-
"\tat kotlinx.coroutines.DeferredCoroutine.await\$suspendImpl(Builders.common.kt:99)\n" +
9089
"\tat kotlinx.coroutines.exceptions.StackTraceRecoveryNestedScopesTest.verifyAwait(StackTraceRecoveryNestedScopesTest.kt:76)\n" +
9190
"\tat kotlinx.coroutines.exceptions.StackTraceRecoveryNestedScopesTest\$testAwaitNestedScopes\$1.invokeSuspend(StackTraceRecoveryNestedScopesTest.kt:71)\n" +
9291
"Caused by: kotlinx.coroutines.RecoverableTestException\n" +

kotlinx-coroutines-core/jvm/test/exceptions/StackTraceRecoveryNestedTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class StackTraceRecoveryNestedTest : TestBase() {
5858
try {
5959
rootAsync.awaitRootLevel()
6060
} catch (e: RecoverableTestException) {
61-
e.verifyException("await\$suspendImpl", "awaitRootLevel")
61+
e.verifyException("awaitRootLevel")
6262
finish(8)
6363
}
6464
}

0 commit comments

Comments
 (0)