Skip to content

Commit

Permalink
Fix: Work around kotlinc NoSuchFieldError
Browse files Browse the repository at this point in the history
Fixes: #1154
  • Loading branch information
zhanghai committed Mar 15, 2024
1 parent 261defa commit a6dab69
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ import java.util.concurrent.Future
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException

inline fun <T, R> Future<T>.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 <T, R> Future<T>.map(
// crossinline transform: (T) -> R,
// crossinline transformException: (Exception) -> Exception = { it }
fun <T, R> Future<T>.map(
transform: (T) -> R,
transformException: (Exception) -> Exception = { it }
): Future<R> =
object : Future<R> {
override fun cancel(mayInterruptIfRunning: Boolean): Boolean =
Expand Down

0 comments on commit a6dab69

Please sign in to comment.