apache / lucenenet

Apache Lucene.NET
https://lucenenet.apache.org/
Apache License 2.0
2.24k stars 639 forks source link

Remove SetLength from ICharTermAttribute #1038

Open paulirwin opened 3 days ago

paulirwin commented 3 days ago

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 https://github.com/apache/lucenenet/pull/1028#discussion_r1848165854_