failsafe-lib / failsafe

Fault tolerance and resilience patterns for the JVM
https://failsafe.dev
Apache License 2.0
4.16k stars 295 forks source link

[question] how to use failsafe with kotlin #375

Open ntthaibk opened 7 months ago

ntthaibk commented 7 months ago

Hi folks, so I'm been using failsafe for java for quite a long time, now I'm moving to new project and decided to adopt it. But run into a problem

When I do Failsafe.with(retryPolicy).get { ... }

kotlin compiler always say that Kotlin: Overload resolution ambiguity Overload resolution ambiguity. All these functions match. public open operator fun <T : Any!> get(supplier: CheckedSupplier<TypeVariable(T)!>!): TypeVariable(T)! defined in dev.failsafe.FailsafeExecutor public open operator fun <T : Any!> get(supplier: ContextualSupplier<TypeVariable(T)!, TypeVariable(T)!>!): TypeVariable(T)! defined in dev.failsafe.FailsafeExecutor

How can I specify the CheckedSupplier in Kotlin?

Thanks and Best regard