svenjacobs01/23/2023, 10:16 AM
type. I’m using a Java API which defines two functions:
void setSomething(boolean enabled)
void setSomething(Boolean enabled)
here. The first function with the primitive Java type is marked deprecated. I’m trying to call the second function from Kotlin code but every time Kotlin tries to unbox the boolean into the primitive type, so it calls the deprecated function. How can I force Kotlin to use the boxed object type? For example I tried
but it’s still complaining.
Vampire01/23/2023, 10:19 AM
true as java.lang.Boolean
svenjacobs01/23/2023, 10:20 AM
Required: kotlin.Boolean Found: java.lang.Boolean
is just marked as an obsolete cast, still tries to call the deprecated function.
true as Boolean
Vampire01/23/2023, 10:22 AM
true as Boolean?
svenjacobs01/23/2023, 10:23 AM