From a6dab695a5205ba15af688b8ac938879d4994b47 Mon Sep 17 00:00:00 2001 From: Hai Zhang Date: Fri, 15 Mar 2024 00:18:33 -0700 Subject: [PATCH] Fix: Work around kotlinc NoSuchFieldError Fixes: #1154 --- .../android/files/provider/common/FutureExtensions.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/me/zhanghai/android/files/provider/common/FutureExtensions.kt b/app/src/main/java/me/zhanghai/android/files/provider/common/FutureExtensions.kt index 0d3bb1b3b..2af8a435e 100644 --- a/app/src/main/java/me/zhanghai/android/files/provider/common/FutureExtensions.kt +++ b/app/src/main/java/me/zhanghai/android/files/provider/common/FutureExtensions.kt @@ -15,9 +15,14 @@ import java.util.concurrent.Future import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException -inline fun Future.map( - crossinline transform: (T) -> R, - crossinline transformException: (Exception) -> Exception = { it } +// The following causes a NoSuchFieldError during runtime, similar to +// https://youtrack.jetbrains.com/issue/KT-20245/ +//inline fun Future.map( +// crossinline transform: (T) -> R, +// crossinline transformException: (Exception) -> Exception = { it } +fun Future.map( + transform: (T) -> R, + transformException: (Exception) -> Exception = { it } ): Future = object : Future { override fun cancel(mayInterruptIfRunning: Boolean): Boolean =