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

Remove redundant field initializers #13060

Merged
merged 3 commits into from Feb 19, 2024
Merged

Conversation

sabi0
Copy link
Contributor

@sabi0 sabi0 commented Jan 30, 2024

In many cases this allowed to mark the field as final.

In many cases this allowed to mark the field as `final`
@@ -32,10 +32,10 @@
*/
public final class DaitchMokotoffSoundexFilter extends TokenFilter {
/** true if encoded tokens should be added as synonyms */
protected boolean inject = true;
final boolean inject;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make these fields private, but not sure if breaking backward compatibility here would be ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this class is marked with @lucene.experimental, we can make the change.

@@ -32,13 +32,13 @@
*/
public final class PhoneticFilter extends TokenFilter {
/** true if encoded tokens should be added as synonyms */
protected boolean inject = true;
final boolean inject;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be changed to private too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a strange case. We're not really breaking backwards compatibility, since no one could have accessed this field anyway with the class being final.

Copy link

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions bot added the Stale label Feb 14, 2024
@github-actions github-actions bot removed the Stale label Feb 15, 2024
@stefanvodita stefanvodita merged commit 9a88d8a into apache:main Feb 19, 2024
5 checks passed
stefanvodita pushed a commit that referenced this pull request Feb 19, 2024
Make protected fields in final classes private.
@sabi0 sabi0 deleted the field_initializers branch February 27, 2024 17:57
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

Successfully merging this pull request may close these issues.

None yet

2 participants