Skip to content

[JavaSymbols] Annotation on backing field of synthesized property from Java is dropped #4573

Description

@juliamcclellan

What is happening? What should have happened instead?

Relates to #4513

Without the experimental java symbol analysis flag enabled, the DProperty synthesized from a Java private field with public accessor methods has annotations from the Java field. With the symbol analysis enabled, the annotation on the field no longer appears on the DProperty.

This scenario seems like it should be equivalent to a regular Kotlin property with a @field annotation, which does have the annotation appear on the DProperty.

If the Java field is public, then the field annotation appears on the DProperty when the symbol analysis is enabled.

Reproducer

package test.pkg
annotation class Anno
package test.pkg;
public class JavaClass {
    @Anno
    private int foo = 0;
    public int getFoo() { return foo; }
    public void setFoo(int foo) { this.foo = foo; }
}
package test.pkg
class KotlinClass {
    @field:Anno
    var foo: Int = 0
}

Dokka version

2.3.0-dev-434

Kotlin Gradle Plugin (KGP) version

No response

Android Gradle Plugin (AGP) version (if applicable)

No response

Build tool

Gradle

Project type

  • Kotlin Multiplatform (KMP)
  • Android
  • JVM
  • Other

Anything else? (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions