Kotlin / dokka

API documentation engine for Kotlin
https://kotl.in/dokka
Apache License 2.0
3.34k stars 396 forks source link

[K2] Java synthetic properties in Kotlin inheritor class shown with `open` modifier #3669

Open atyrin opened 4 days ago

atyrin commented 4 days ago

Create a Java class with a field with getter/setter that will be represented in Kotlin as one property.

public class JavaParent {
    private String foo;

    public String getFoo() {
        return foo;
    }

    public void setFoo(String foo) {
        this.foo = foo;
    }
}

Create a Kotlin class that will inherit the Java class

class Child: JavaParent()

For K1 Kotlin classes will looks like (no open modifier for foo):

image

For K2 it shown the modifier:

image
  1. The open doesn't have any effect in the final class ([NON_FINAL_MEMBER_IN_FINAL_CLASS])
  2. If we will make Child an open class then anyway we cannot override it in a child class of Child. ([NOTHING_TO_OVERRIDE])
vmishenev commented 4 days ago

Related issue: #3611