James Whitehead08/24/2021, 11:36 AM
? I see we have
, etc, but I haven't found anything for interface. 2. Follow up question; is
the recommended way to get the interfaces implemented by a given class?
Ivan Pavlov08/24/2021, 12:05 PM
and process them somehow I guess
Rob Elliot08/24/2021, 1:58 PM
val KClass<*>.isInterface get() = constructors.isEmpty()
Ivan Pavlov08/24/2021, 2:01 PM
Please note that the constructors counting solution might not be very precise for general purpose use. For example, Kotlin package facade classes do not have any constructors either, but they are not interfaces (UPD: and their constructors cannot even be reflected with, just as those of anonymous classes,
kotlin-reflectand maybe more).
Rob Elliot08/24/2021, 2:03 PM
James Whitehead08/24/2021, 11:06 PM
for an interface. Which is fine for my use case, but probably not very helpful if one were trying to distinguish between a class, abstract class and an interface.