-
Notifications
You must be signed in to change notification settings - Fork 452
Description
Describe the bug
If, in Java, we have
public String getFoo();
public void setFoo(String new);
private String foo;
Then because the documentable model stores getters and setters inside of a DProperty
, and private-visibility elements don't appear in the model, the model must contain a public foo: String
with a .getter
field containing the getter and a .setter
field containing the setter.
This means that, viewing this Java code as-Kotlin, we see the correct public foo: String
, but viewing this Java code as-Java we see a public getter, public setter, and public
backing field.
In addition, if we have, in Kotlin,
public var bar: String
and this does not have @JvmField
, this should only produce getters and setters as-Java, and not a public String bar
.
However, there is a similar problem to the above: if the DProperty
to which the getters and setters belong were private, it couldn't be in the model. If it were public, then we would have the public String bar
(the latter is the current state of affairs).
Possibly of note is that the second issue above does not occur if you do
@get:@JvmName("someNewGetter")
public var baz: String
though I am not sure why.
One possible solution may involve introducing a new, fake visibility thisPropertyIsPublicInKotlinHiddenInJavaAndHasPublicJavaAccessors
though a naive approach like that might run into issues with needing duplicates for cases like protected
, protected set public get
, etc.
It is possible there may be further complexities around @JvmName
and/or inheritance.