makes toMap call-site to work, but not the definition
u
udalov
02/17/2017, 12:01 PM
I’ve tried the following, and it seems to work
Copy code
class ClassFactory<T>(val clazz: Class<out T>) {
fun toMap(instance: T): Map<String, Any?> {
return emptyMap()
}
}
fun test(x: Any?) {
when (x) {
null -> {}
else -> {
ClassFactory(x::class.java).toMap(x)
}
}
}
d
Deactivated User
02/17/2017, 12:03 PM
uhm
Deactivated User
02/17/2017, 12:04 PM
maybe it's a bug then that reproduces with a more complex example
Deactivated User
02/17/2017, 12:04 PM
going to try to reduce it
👍 1
Deactivated User
02/17/2017, 12:06 PM
ok, it was my problem. It has a operator fun invoke for constructing in order to be able to cache it, and I didn't changed the Class<out> for that case 🙂