Skip to content

Commit

Permalink
Upgrade to Kotlin Coroutines 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
sdeleuze committed May 22, 2023
1 parent 7efd347 commit f956d39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion framework-platform/framework-platform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies {
api(platform("org.apache.groovy:groovy-bom:4.0.11"))
api(platform("org.apache.logging.log4j:log4j-bom:2.20.0"))
api(platform("org.eclipse.jetty:jetty-bom:11.0.15"))
api(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4"))
api(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.1"))
api(platform("org.jetbrains.kotlinx:kotlinx-serialization-bom:1.4.0"))
api(platform("org.junit:junit-bom:5.9.3"))
api(platform("org.mockito:mockito-bom:5.3.1"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.reactive.AwaitKt;
import kotlinx.coroutines.reactive.ReactiveFlowKt;
import kotlinx.coroutines.reactor.MonoKt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.reactivestreams.Publisher;
Expand Down Expand Up @@ -372,9 +372,8 @@ protected Object invokeWithinTransaction(Method method, @Nullable Class<?> targe
}
Object result = txSupport.invokeWithinTransaction(method, targetClass, callback, txAttr, rtm);
if (corInv != null) {
Publisher<?> pr = (Publisher<?>) result;
return (hasSuspendingFlowReturnType ? KotlinDelegate.asFlow(pr) :
KotlinDelegate.awaitSingleOrNull(pr, corInv.getContinuation()));
return (hasSuspendingFlowReturnType ? KotlinDelegate.asFlow((Publisher<?>) result) :
KotlinDelegate.awaitSingleOrNull((Mono<?>) result, corInv.getContinuation()));
}
return result;
}
Expand Down Expand Up @@ -901,10 +900,10 @@ private static Object asFlow(Publisher<?> publisher) {
return ReactiveFlowKt.asFlow(publisher);
}

@SuppressWarnings({"unchecked", "deprecation"})
@SuppressWarnings("unchecked")
@Nullable
private static Object awaitSingleOrNull(Publisher<?> publisher, Object continuation) {
return AwaitKt.awaitSingleOrNull(publisher, (Continuation<Object>) continuation);
private static Object awaitSingleOrNull(Mono<?> publisher, Object continuation) {
return MonoKt.awaitSingleOrNull(publisher, (Continuation<Object>) continuation);
}

public static Publisher<?> invokeSuspendingFunction(Method method, CoroutinesInvocationCallback callback) {
Expand Down

0 comments on commit f956d39

Please sign in to comment.