I’ve got a Java library that declares several subc...
# announcements
o
I’ve got a Java library that declares several subclasses of type
ClassifierTrainer<double[]>
I need to assign any such subclass to a Kotlin variable but can’t figure out a type that works. The obvious
ClassifierTrainer<Array<Double>>
fails. Anyone know the right way to do this?
a
oliverdain: DoubleArray
o
Oh, RIGHT! I knew that....
Thanks!!
@aimozg Before you pointed me in the right direction I was trying to figure it out bydoing a little reflection. Something like
<http://log.info|log.info>(”The type is: {}”, TreeClassifier.Trainer::class.superClass.genericType)
but there doesn’t seem to be a way to get the superclass or the generics from a
KClass
. doesn’t matter now but just out of curiosity, is it possible to do what I was trying to do?
a
sorry, no idea, try asking #reflect
o
OK. Thanks.