File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
integration/kotlinx-coroutines-guava Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public fun <T> CoroutineScope.future(
4040 val newContext = newCoroutineContext(context)
4141 val future = SettableFuture .create<T >()
4242 val coroutine = ListenableFutureCoroutine (newContext, future)
43- future .addCallback(coroutine, MoreExecutors .directExecutor())
43+ Futures .addCallback(future, coroutine, MoreExecutors .directExecutor())
4444 coroutine.start(start, coroutine, block)
4545 return future
4646}
Original file line number Diff line number Diff line change 44
55package kotlinx.coroutines.guava
66
7+ import com.google.common.base.*
78import com.google.common.util.concurrent.*
89import kotlinx.coroutines.*
910import org.junit.Test
@@ -55,7 +56,11 @@ class ListenableFutureExceptionsTest : TestBase() {
5556 // Fast path
5657 runTest {
5758 val future = SettableFuture .create<Int >()
58- val chained = if (transformer == null ) future else Futures .transform(future, transformer)
59+ val chained = if (transformer == null ) {
60+ future
61+ } else {
62+ Futures .transform(future, Function (transformer), MoreExecutors .directExecutor())
63+ }
5964 future.setException(exception)
6065 try {
6166 chained.await()
@@ -67,7 +72,11 @@ class ListenableFutureExceptionsTest : TestBase() {
6772 // Slow path
6873 runTest {
6974 val future = SettableFuture .create<Int >()
70- val chained = if (transformer == null ) future else Futures .transform(future, transformer)
75+ val chained = if (transformer == null ) {
76+ future
77+ } else {
78+ Futures .transform(future, Function (transformer), MoreExecutors .directExecutor())
79+ }
7180 launch {
7281 future.setException(exception)
7382 }
You can’t perform that action at this time.
0 commit comments