Skip to content

Generated class is incorrect when data class has a read-only property with custom accessor #3

@asaudemont

Description

@asaudemont

Sample class that illustrates the error:

@DataClass data class Foo(val x: Int) {
    var y: Int
        get() = x + 1
}

The generated class attempts to read a y property from the JSON object. It then instantiates Foo by including y in the constructor call, which is invalid and results in a compilation error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions