Skip to content

[K2] Incorrect modifier for property from Java getter/setter #3339

@atyrin

Description

@atyrin

The case is pretty synthetic, but I had such code in my project, so
Parent.java

public class Parent {
    public int publicPropertyWithProtectedGetterProtectedSetter = 0;

    protected int getPublicPropertyWithProtectedGetterProtectedSetter() {
        return publicPropertyWithProtectedGetterProtectedSetter;
    }

    protected void setPublicPropertyWithProtectedGetterProtectedSetter(int publicPropertyWithProtectedGetterProtectedSetter) {
        this.publicPropertyWithProtectedGetterProtectedSetter = publicPropertyWithProtectedGetterProtectedSetter;
    }
}

Child.kt

open class Child: Parent()

In K1 Child list member is just the same as in the code:
image


In K2 getter/setter is omitted. But for some reason protected wins over public
image

Installation

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglanguage: JavaIssue/PR related to the Java language feature/analysis/docstopic: K2Issues / PRs that are related to the K2 migration. See #2888

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions