Do the types in kotlin.collections implement any o...
# getting-started
m
Do the types in kotlin.collections implement any of the java.lang or java.util interfaces on the JVM? e.g. java.util.List, java.lang.Iterable
k
There's some magic to it but yes, Kotlin's
List
implements
Iteratable
and they're both mapped to the respective Java type.
f
@Matthew Hall: I'm guessing you're asking for this issue : https://github.com/jdbi/jdbi/issues/1482?
m
correct
k
Could you give some context? What exactly is going on in that issue?
a
List<E> (E : Enum<E>) is being mapped to java.util.List<? extends E> and it looks like jdbi doesn’t handle that
Kotlin adds the wildcard because it sees List as immutable and hence the E is an “out” parameter. imho it’s doing the right thing, and jdbi should just trim the wildcard to its upper bound
the JvmSuppressWildcard annotation works too, that’s what I used for Guice
well, except that Enum classes in Java are final if their values don’t actually override anything ..
k
I see, that's a lot of things coming together!
m
I believe we've found a workaround for the current use case: when the type variable extends
Enum
, we get the erased type--which for an
out MyEnum
type variable just gives
MyEnum.class
.
We might have to give thought to whether it is legitimate for us to reduce
? extends Foo
to just
Foo
for our use case