From 356e8735e54de8bc2669ebe89462e9da64994f90 Mon Sep 17 00:00:00 2001 From: Vadim Semenov Date: Tue, 1 Dec 2020 15:37:07 +0000 Subject: [PATCH] Remove protection from downcasting in asDeferred To work around #2423. --- integration/kotlinx-coroutines-guava/src/ListenableFuture.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/kotlinx-coroutines-guava/src/ListenableFuture.kt b/integration/kotlinx-coroutines-guava/src/ListenableFuture.kt index 6d1fab3d69..9d84eef3d5 100644 --- a/integration/kotlinx-coroutines-guava/src/ListenableFuture.kt +++ b/integration/kotlinx-coroutines-guava/src/ListenableFuture.kt @@ -152,8 +152,8 @@ public fun ListenableFuture.asDeferred(): Deferred { deferred.invokeOnCompletion { cancel(false) } - // Return hides the CompletableDeferred. This should prevent casting. - return object : Deferred by deferred {} + // TODO: prevent down casting when #2423 is fixed. + return deferred } /**