apache / apache/lucene

Seal the BitSet class

Open
#15,038 2 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

`BitSet` is used in some performance-critical places. We should seal this class so that it only allows `FixedBitSet` and `SparseFixedBitSet` as sub-classes, to prevent applications from mistakenly hurting performance by creating other sub-classes that could make call sites of `BitSet#get`, `BitSet#nextSetBit` and others polymorphic?

Contributor guide

Open the contributing guide

Research direction

Locate BitSet, FixedBitSet, and SparseFixedBitSet in the Java source and inspect their declarations and inheritance relationships first. Make BitSet permit only the two named subclasses, then run the relevant Lucene tests or build checks to confirm the change is valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.