jeudi 24 février 2022

Kotlin reflection fails to return function after update to version 1.6.10

I have the following kotlin property declared in a class of my Android app:

private val updateRef: KFunction<*> by lazy {
    dao::class.functions.find {it.name.equals("update", true)}!!
}

Where dao is a reference to a Room DAO interface. Since I've updated kotlin to version 1.6.10 it doesn't work anymore, the following wierd exception is thrown every time I try to execute the code above. The same exception is thrown when I evaluate the expression using Android Studio's EVALUATE tool:

"Incorrect resolution sequence for Java method public open suspend fun count(): kotlin.Int defined in it.kfi.lorikeetmobile.db.dao.TablePriorityDao_Impl[JavaMethodDescriptor@d45ec9a]".

Where count() is a suspend method declared in the DAO interface. But I get this for every DAO class I have in my project and for different methods, so I think the method has nothing to do with the real problem here... I cannot figure out what is happening.

Before the update I had no problems at all. Please help.





Aucun commentaire:

Enregistrer un commentaire