How can I make an extension function to wrap this ...
# announcements
d
How can I make an extension function to wrap this Java
mappingFunction
...:
@Nullable  V get(@NonNull K key, @NonNull Function<? super K, ? extends V> mappingFunction);
I really don't know what could be wrong:
Copy code
suspend inline fun <reified K : Any, reified V : Any> Cache<K, V>.get(key: K, crossinline mappingFunction: suspend (K) -> V): V? =
	get(key) { runBlocking { mappingFunction(it) } }
it's probably related to the generics... 🤕
d
Member functions have precedence.
Oh but this is suspend. Nvm.
d
I think you're right... I tried renaming it and the IDEA did except it...
I just wonder why... to the compiler the params are different...?
d
When you call it, do you actually use suspension?
d
yes
d
Hmm, to save you time, just rename it.
d
Yup, that's what I did, thanks for the info about member functions... 🙂