Newbie: why are there no Java class property references?

Hi all,
In Kotlin it is easy to make type safe frameworks that no longer need strings to refer to properties because we can use classname::propertyname to get a KProperty - which is a typeful reference to the actual thing. This solves one of my biggest complaints on Java :wink:

But this only works for kotlin classes, sadly enough. While “properties” on a Java class can be accessed with Kotlin property syntax the same does not go for property reference: it seems to be impossible to get a KProperty using the same syntax. This is bad news because it means lot of legacy code cannot be used with newer framework code that would try to use Kotlin property references.

Is there a reason for this “omission”, and can anyone think of a workaround?

Here’s the relevant issue: https://youtrack.jetbrains.com/issue/KT-8575

Thanks, I’ll vote for it and keep my fingers crossed :wink:

This is what you are looking for: JvmField - Kotlin Programming Language