https://kotlinlang.org logo
Title
o

oliverdain

02/12/2017, 1:21 AM
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

aimozg

02/12/2017, 1:24 AM
oliverdain: DoubleArray
o

oliverdain

02/12/2017, 1:24 AM
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

aimozg

02/12/2017, 1:40 AM
sorry, no idea, try asking #reflect
o

oliverdain

02/12/2017, 1:57 AM
OK. Thanks.