I’d like access to the
KTypeParameters of an interface or class for meta-programming, similar to the current access to class members:
interface ITyped<X: Number, Y> val xParam: KTypeParameter<Number> = ITyped::X
Of course KTypeParameter or something similar would need to be generic in it’s bound.
Ideally, there would be the ability to resolve the value of a type parameter by a class that defines it, like
TypeToken.resolve in guava:
class Concrete : ITyped<Int, String> ITyped::X.resolveIn(Concerete::class) // => Int
I wasn’t able to find any other discussion about this sort of feature, why it’s apparently missing in Kotlin, and what the best way to do this sort of thing given the current functionality. Thanks.