You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason for this is that Kotlin has declaration-site variance and the immutable kotlin.collections.Set is covariant (public interface Set<out E> : Collection<E>), which translates to java.util.Set<? extends java.lang.String> at runtime.
The easiest way to fix this would be to use Kotlin's built-in typeOf in Configurate's Kotlin extension functions. As an additional benefit, this also removes the overhead of tons of anonymous classes.
Since Kotlin's type variance works different, there are some issues when using
io.leangen.geantyref.TypeToken
:In Java, this works as expected:
In Kotlin, this interpreted wrongly:
This can then lead to unexpected exceptions, as Configurate won't find serializes for type
? extends String
:The reason for this is that Kotlin has declaration-site variance and the immutable
kotlin.collections.Set
is covariant (public interface Set<out E> : Collection<E>
), which translates tojava.util.Set<? extends java.lang.String>
at runtime.The easiest way to fix this would be to use Kotlin's built-in
typeOf
in Configurate's Kotlin extension functions. As an additional benefit, this also removes the overhead of tons of anonymous classes.The text was updated successfully, but these errors were encountered: