Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K2] Synthetic property misses annotations from getter/setter #3688

Open
atyrin opened this issue Jul 10, 2024 · 3 comments · May be fixed by #3715
Open

[K2] Synthetic property misses annotations from getter/setter #3688

atyrin opened this issue Jul 10, 2024 · 3 comments · May be fixed by #3715
Assignees
Labels
bug topic: K2 Issues / PRs that are related to the K2 migration. See #2888

Comments

@atyrin
Copy link
Contributor

atyrin commented Jul 10, 2024

Create a Java class and annotate the setter method.

// JavaParent.java
import java.beans.BeanProperty;

public class JavaParent {
    private int context = 0;

    public int getContext() {
        return context;
    }

    @BeanProperty(required = true)
    public void setContext(int context) {
        this.context = context;
    }
}

Use it as a superclass in Kotlin.

class A : JavaParent()

The synthetic property context will miss the annotation in Dokka.

K1:
image


K2
image

@atyrin atyrin added bug topic: K2 Issues / PRs that are related to the K2 migration. See #2888 labels Jul 10, 2024
@vmishenev
Copy link
Member

In K1, we have a check - if an annotation application is from sources then Dokka renders it.
In K2, a similar check does not work in Java.
Do we need this check?!

@vmishenev
Copy link
Member

In K2, we should get rid of this check.

@vmishenev vmishenev self-assigned this Jul 24, 2024
@vmishenev
Copy link
Member

vmishenev commented Jul 25, 2024

This check is for annotations added by the compiler.
For example, the compiler adds the annotation ParameterName for a parameter name in this case:
val nF: (param: Int) -> String = { _ -> "" }

Nevertheless, a user can write it manually:

val nF:  (@ParameterName(name="param") Int) -> String = { _ -> "" }

will render in K1 as (a parameter name will be added):
image

@vmishenev vmishenev linked a pull request Jul 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug topic: K2 Issues / PRs that are related to the K2 migration. See #2888
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants