I need to be able to list all properties, includin...
# getting-started
v
I need to be able to list all properties, including private superclass properties via Kotlin reflection:
Copy code
fun main() {

    abstract class Animal {
        private val name: String = "Jack" // removing "private" fixes it
    }

    class Dog : Animal() {
        private val age: Int = 3
    }

    Dog::class.memberProperties.size // = 1, "name" is missing
}
Am I missing something? Is there a way to do it?
If this was an intentional decision to not include them I find that pretty annoying since I can just use the Java reflection API…. So it’s not like this is improving any security.
y
There's an
allProperties
property I think. You need full jvm reflection though