dokka
dokka copied to clipboard
[K2] Inconsistent member representation for Java/Kotlin files
Parent.java
:
public class Parent {
protected int protectedPropertyWithPublicGetterPublicSetter = 0;
public int getProtectedPropertyWithPublicGetterPublicSetter() {
return protectedPropertyWithPublicGetterPublicSetter;
}
public void setProtectedPropertyWithPublicGetterPublicSetter(int protectedPropertyWithPublicGetterPublicSetter) {
this.protectedPropertyWithPublicGetterPublicSetter = protectedPropertyWithPublicGetterPublicSetter;
}
}
Child.kt
open class Child: Parent()
In K1, both pages look the same:
In K2, the page for Java parent looks the same as in K1. But for Kotlin, inheritor getter/setter methods are omitted.
Representation in K2 for Kotlin files looks correct (as no getters/setters are available in the code). But it seems for the Java class, it should be the same.
Installation
- Dokka version: 1.9.20
Parent: #3328
Related: #3128
For the given code, the child's page and the parent's page should look the same, as for the K2 child's page, so like this
Blocked by #3576
The summary based on the spike https://github.com/Kotlin/dokka/issues/3576: Presumably we decided to show a backing field, a getter, and a setter always. We are going to ask to validate our decision other teams, e.g. Kotlin Evolution (as they can have plans on https://youtrack.jetbrains.com/issue/KT-6653).
We are not sure about the case with a private field:
public class A {
private int prop = 1;
public int getProp() {
return prop;
}
public void setProp(int a) {
this.prop = a;
}
}
Should Dokka display accessors here?! Despite the counter-example below, It seems a field and its accessors should be an united entity.
class B : A() {
override fun getProp(): Int {
....
}
override fun setProp(a: Int) {
...
}
}