What is a good way to get around not being able to use reified type parameters in an interface? I want to have a method like
Copy code
override inline fun <reified T> foo(key: String, value: T): T {
}
but it's not possible since you can't
inline
an interface function
v
voddan
08/15/2017, 4:03 AM
It depends on what you are using the
T
for. The code in your snippet works just the same if you remove
reified
b
bachhuberdesign
08/15/2017, 4:06 AM
I need to call
value::class.java
directly (which only works if it's reified). I guess I could pass the class as a parameter but I would like to keep the client code as simple as possible
k
kirillrakhman
08/15/2017, 6:41 AM
You can declare
inline
extension functions for your interface
v
voddan
08/15/2017, 8:43 AM
@bachhuberdesign are you sure you need reifying for that? It compiles for me