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 SetLength and SetEmpty from ICharTermAttribute #1038

Closed
paulirwin opened this issue Nov 19, 2024 · 0 comments · Fixed by #1049
Closed

Remove SetLength and SetEmpty from ICharTermAttribute #1038

paulirwin opened this issue Nov 19, 2024 · 0 comments · Fixed by #1049
Assignees
Labels
is:task A chore to be done notes:breaking-change Has changes that will break backward compatibility pri:high

Comments

@paulirwin
Copy link
Contributor

paulirwin commented Nov 19, 2024

There doesn't seem to be a good reason to force implementations to define SetLength(), since it should just cascade the call to the setter of Length. We should remove this from the interface and make this method into an extension method on ICharTermAttribute (in a Lucene.Net.Analysis.TokenAttributes.Extensions namespace). It should also be made to return the type of ICharTermAttribute it is called upon rather than the interface type.

Originally posted by @NightOwl888 in #1028 (comment)

Update: We should also remove SetEmpty and make it an extension method as well, and add a Clear() method in its place for API consistency.

@paulirwin paulirwin added this to the 4.8.0-beta00018 milestone Nov 19, 2024
@paulirwin paulirwin added the is:task A chore to be done label Nov 19, 2024
@paulirwin paulirwin added notes:breaking-change Has changes that will break backward compatibility pri:high labels Nov 21, 2024
paulirwin added a commit to paulirwin/lucene.net that referenced this issue Nov 26, 2024
paulirwin added a commit to paulirwin/lucene.net that referenced this issue Nov 26, 2024
@paulirwin paulirwin changed the title Remove SetLength from ICharTermAttribute Remove SetLength and SetEmpty from ICharTermAttribute Nov 26, 2024
@paulirwin paulirwin self-assigned this Nov 26, 2024
paulirwin added a commit that referenced this issue Dec 3, 2024
* Remove SetLength and SetEmpty from ICharTermAttribute, add extension methods

* Remove CopyTo from IAttribute, add Clear to ICharTermAttribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:task A chore to be done notes:breaking-change Has changes that will break backward compatibility pri:high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant