# Property reference from Java class

**URL:** <https://discuss.kotlinlang.org/t/property-reference-from-java-class/23532>\
**Category:** Support\
**Created:** [November 24, 2021, 4:59pm UTC](https://discuss.kotlinlang.org/t/property-reference-from-java-class/23532 "2021-11-24T16:59:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thumannw](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@thumannw](https://discuss.kotlinlang.org/u/thumannw)\
**Post date:** [November 24, 2021, 4:59pm UTC](https://discuss.kotlinlang.org/t/property-reference-from-java-class/23532/1 "2021-11-24T16:59:14Z")

</div>

Consider a class/interface written in Java with a getter and corresponding setter.

```java
public interface MyInterface {
    String getMyProperty();
    void setMyProperty(String s);
}

```

From Kotlin, the getter and setter are accessible via property notation. Also, we can obtain function references from both methods. But a property reference does not work.

```kotlin
fun f(my: MyInterface) {
    println(my.myProperty) // ok
    my.myProperty = "foo" // ok
    val getter = my::getMyProperty // ok
    val setter = my::setMyProperty // ok
    val prop = my::myProperty // does not work
}

```

Is there some reason to it or is it just not implemented. Is there another way to obtain a `KMutableProperty` from it? Note that in my use-case, the Java class comes from a library and is not modifyable. Also, there are many such cases and writing a wrapper for each of them is not feasible.

---

<div class="post-metadata">

**Author:** ![Beholder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/beholder/32/2078_2.png) [@Beholder](https://discuss.kotlinlang.org/u/Beholder)\
**Post date:** [November 26, 2021, 1:09pm UTC](https://discuss.kotlinlang.org/t/property-reference-from-java-class/23532/2 "2021-11-26T13:09:44Z")

</div>

There is an issue for that: [KT-8575: Support Java synthetic property references](https://youtrack.jetbrains.com/issue/KT-8575)
