Any possibility to make the below code compilable:...
# getting-started
c
Any possibility to make the below code compilable:
Copy code
abstract class SomeLibraryClass<T> {
    abstract fun test(key: String): T
}

class Item<T : Enum<T>> : SomeLibraryClass<T>() {
    override fun test(key: String): T {
        return enumValueOf(key)
    }
}
Can't make T as
reified
or
test
as inline. How can I inherit the library class for enum?
c
Something like this would work. The
companion object
is totally optional, but it allows constructing via
Item<Foobar>()
instead of
Item(Foobar::class.java)
c
Thanks Cedrick 👍