Skip to content

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

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

Open
asaudemont opened this issue Oct 1, 2018 · 0 comments

Comments

@asaudemont
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant