I'm trying use Koltin Poet to generate data classe...
# announcements
n
I'm trying use Koltin Poet to generate data classes for JPA. I'm stuck at trying to create a
val owners: MutableSet<MyObject> = mutableSetOf()
because
MutableSet::class
is
class kotlin.collections.Set
and not
class kotlin.collections.MutableSet
. Any idea why that is the case (or even better what I can do to fix this)?
k
MutableSet
and co don't exist at runtime.
n
Hmm. I looked at the source and both
Set
and
MutableSet
are interfaces. I "cheated" for now by using a literal String
k
Right, the kotlin source for them exists.
But ArrayList and other JVM implementations of lists can't know about the interface, so the kotlin compiler has to cheat.
n
Ah, good to know. So seems there is no way around my cheating.