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

Design: TaskSequence.REPEAT_EXHAUST is mutable #14151

Open
paulirwin opened this issue Jan 18, 2025 · 0 comments
Open

Design: TaskSequence.REPEAT_EXHAUST is mutable #14151

paulirwin opened this issue Jan 18, 2025 · 0 comments
Labels

Comments

@paulirwin
Copy link

Description

(Found during reviewing code while porting to the Lucene.NET project.)

The static TaskSequence.REPEAT_EXHAUST field has been perhaps accidentally left as a mutable static field. It appears that this field is only ever used a sentinel value that is not intended to be mutated, and should be marked final. As far as I can tell, there is no justification to have this field be mutable. Although this is just benchmark code, and thus I'm sure very low priority, it could potentially result in bugs if it is mutated during execution.

Version and environment details

Affects Lucene 4.0.0 through current (10.1.0)

msfroh added a commit to msfroh/lucene that referenced this issue Feb 11, 2025

Unverified

No user is associated with the committer email.
Following up on
apache#14151 and
apache#14152, I decided to grep for
other non-final public static variables in the Lucene codebase.

This change makes statics final where it is both possible and seems
appropriate. (That is, the variables really do seem to be constants.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant