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

Avoid using data classes in the API #984

Open
3flex opened this issue Sep 2, 2024 · 1 comment
Open

Avoid using data classes in the API #984

3flex opened this issue Sep 2, 2024 · 1 comment

Comments

@3flex
Copy link

3flex commented Sep 2, 2024

I noticed that the API makes liberal use of Kotlin data classes. This is discouraged for libraries:

I suggest removing data classes from the public API. If any of those classes still require equals, hashCode and toString implementations the Poko compiler plugin can generate those by adding a simple annotation to classes that require it.

I would be happy to work on a PR for this but given it would be a breaking change I'm not sure if this should be parked until a possible v2 release or if it could be done as part of v1.6.

@nielsvanvelzen
Copy link
Member

This is definitely something to consider changing in a future release, and I have thought about it before. Fortunately, we have our own code generator so we can extend that to generate the hashCode/toString functions. The only problem will be in the copy function where we can't keep compatibility.

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

2 participants