https://kotlinlang.org logo
i

ildar.i [Android]

01/09/2020, 10:53 AM
Hi! Had to move method from class to extention and now it throws
java.lang.IllegalAccessException: Class clean.db.entities.LocalizationDbEntityKt can not access a member of class infin.api.core.legal.entities.auth.login.LocalizationFromServer with modifiers "private final"
Copy code
fun LocalizationFromServer.toList() = LocalizationFromServer::class.java.declaredFields.map {
    LocalizationDbEntity(it.name, it.get(this)?.toString())
}
Cah anyone help pls?
r

ribesg

01/09/2020, 11:09 AM
You should be able to call
it.setAccessible
in your
map { }
before calling
it.get
, or something like that
👍 1
i

ildar.i [Android]

01/09/2020, 11:14 AM
Thanks, setting
it.isAccessible = true
worked!
👌 1
2 Views