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

Find more classes in main branch that can be converted to record classes #13207

Open
3 of 6 tasks
uschindler opened this issue Mar 24, 2024 · 0 comments
Open
3 of 6 tasks

Comments

@uschindler
Copy link
Contributor

uschindler commented Mar 24, 2024

Description

This is an overview issue about all classes in current Lucene's main branch to be ported over to record classes. Record classes are fine for immutable data structures which have no functionality and are not part of class hierarchy (they have no superclass).

Records offer several simplifications for implementing them:

  • equals, hashCode and toString are autogenerated by an invokedynamic, so we can't forget to handle it correctly
  • it is also immutable
  • all parameter checking logic can be moved to some special constructor without any parameters (this is new syntax since Java 17)
  • In later java versions they will have an optimized internal layout and arrays of record classes may no longer be pointer arrays (see Project Valhalla with a first preview of it in Java 22). In future they will also not have identity anymore (I don't understand the impact yet).

The first PR #13205 already added support for record classes in our Javadoc linter (missing-doclet plugin).

The following classes are candidates (please add more here and add link to PR):

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

No branches or pull requests

1 participant