Suppose I have: ```annotation class MyAnnotation(v...
# announcements
p
Suppose I have:
Copy code
annotation class MyAnnotation(val someValue: String, val optionalClass: KClass<*> = MyDefaultImplementation::class)

interface MyInterface {
    fun doSomething(input: Any?): Any?
}

class MyDefaultImplementation: MyInterface {
    override fun doSomething(input: Any?): Any? = input.toString()
}
How can I set a bound on
optionalClass
to make sure only a class which implements
MyInterface
is provided?
e
val optionalClass: KClass<out MyInterface>
should work.
p
Ah yes, thank you!