salvatorecampagna commented on code in PR #16282:
URL: https://github.com/apache/lucene/pull/16282#discussion_r3458820513
##########
lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java:
##########
@@ -867,6 +867,10 @@ public static FixedBitSet copyOf(Bits bits) {
if (bits instanceof FixedBitSet fbs) {
return fbs.clone();
+ } else if (bits instanceof DenseLiveDocs denseLiveDocs) {
+ return denseLiveDocs.toFixedBitSet();
+ } else if (bits instanceof SparseLiveDocs sparseLiveDocs) {
+ return sparseLiveDocs.toFixedBitSet();
Review Comment:
Thanks for the suggestion. The interface would make `copyOf()` cleaner, but
the tricky part is that `FixedBitSet` itself would also need to implement it
(to handle the case after the `FixedBits` unwrap at the top of the method).
That means adding a `toFixedBitSet()` method to `FixedBitSet` whose only
implementation is `return clone()`, which feels redundant and a bit odd
semantically. Happy to go that route if the consensus is that the cleaner
dispatch is worth it, but leaning toward keeping the `instanceof` chain since
it mirrors the existing pattern already in the method for
`FixedBits`/`FixedBitSet`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]