[ https://issues.apache.org/jira/browse/LUCENE-9325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17083471#comment-17083471 ]
Michael Sokolov commented on LUCENE-9325: ----------------------------------------- +1 for this. It's even possible to alter seeming constants such as Sort.RELEVANCE and Sort.INDEXORDER; this happened to us since they were passed around in a sort variable that we later modified for perfectly valid reasons :) > Sort and SortField are not immutable > ------------------------------------ > > Key: LUCENE-9325 > URL: https://issues.apache.org/jira/browse/LUCENE-9325 > Project: Lucene - Core > Issue Type: Improvement > Reporter: Alan Woodward > Assignee: Alan Woodward > Priority: Major > > 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. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org