Kotlin reflect give a wildcard generic type for String

object A:ConfigKey<List<Set<String>>>

fun main(){

console print:

config.ConfigKey<java.util.List<? extends java.util.Set<? extends java.lang.String>>>

I 'm surprised why <? extends java.lang.String>
And are there any way to remove all wildcard?

Thank you

There is, but first you need to know that read-only collection interfaces in Kotlin are covariant by nature, that’s why you see those ? extends wildcards.

If you really need you can use @JvmSuppressWildcards there.

Thank you