Sort and SortField are not immutable [LUCENE-9325]
Open
legacy-jira-priority:Major
type:enhancement
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
The `Sort` and `SortField` classes are currently mutable, which makes them dangerous to use in multiple threads. In particular, you can set an index sort on an IndexWriterConfig and then change its internal sort fields while the index is being written to.
We should make all member fields on these classes final, and in addition we should make `Sort` final itself.
---
Migrated from [LUCENE-9325](https://issues.apache.org/jira/browse/LUCENE-9325) by Alan Woodward (@romseygeek), updated Oct 06 2021
Pull requests: https://github.com/apache/lucene/pull/338
Contributor guide
Assessment
This issue has not been assessed yet.