Remove `ICharSequence` from `ICharTermAttribute` and buffer types
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 658
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 9
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Task description
Follow-up to #1315 (step 2-3 of the plan in https://github.com/apache/lucenenet/issues/1315#issuecomment-4683039760).
Now that `IBufferWriter` and `Append(ReadOnlySpan)` are going to be in place (as of #1315), we can move off `ICharSequence` on the buffer types.
### Phase 1 - Rework callers (non-breaking)
Replace internal logic that consumes `ICharSequence` (from `CharTermAttribute`, `OpenStringBuilder`, and other buffer types) with `ReadOnlySpan` or `ReadOnlyMemory` where appropriate. This is purely internal call-site refactoring and must land before the removal below.
### Phase 2 - Remove the implementation (breaking)
Remove the `ICharSequence` implementation from `ICharTermAttribute` and all buffer types at the same time:
- Drop `SubSequence()` and `HasValue`.
- Promote any still-needed members directly onto `ICharTermAttribute`.
### Known consequence
Because the compiler does not honor a concrete type's implicit operators through an interface, callers will need to call `.AsSpan()` explicitly on `ICharTermAttribute` to pass it into `ReadOnlySpan` APIs. On the upside, once `ICharSequence` is gone there is no risk of accidentally routing a value into an `ICharSequence` API when `ReadOnlySpan` is the better choice.
This is a breaking change and should be done in a beta release before 4.x final.
Contributor guide
Assessment
This issue has not been assessed yet.