-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Initial feature flags API #274
base: 1.19.3
Are you sure you want to change the base?
Conversation
@Unique | ||
private final BitSet quilt$additionalFlags = new BitSet(); | ||
|
||
@Inject(method = "isIn", at = @At(value = "RETURN", ordinal = 2), cancellable = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather see use of @Slice
over ordinals. Ordinals are super fragile (what if the method adds an early return at the head?) and if this code ever breaks, it's not going to be clear to me (or whoever else takes up the responsibility of porting) what you were targeting. Feel free to ping me if you need help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, ordinal is fairly safe because the function is 6 lines, an if-else chain with two early returns, then a simple bit mask check. If a slice is still recommended I can put one in, but this is one of the few cases where I think including a slice is unnecessary or possibly even more confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, I'd like enough description of some kind (either a few words in a comment or a slice) that gives me enough of an idea that I could fix the ordinals on this mixin in an update without needing to open up an old QSL workspace and reverse-engineer the injection points myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't do a proper review just yet (phone review time) so here's a nitpick
* Provides helper methods for working with {@link FeatureFlag}s. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface QuiltFeatureFlags { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a (final) class for consistency.
An API to make use of the new
FeatureFlags
system.Originally limited to 64 flags, this API extends the size of feature flags using a
BitSet
, which grows as needed.Additionally, the
GatedFeature#FILTERED_REGISTRIES
set is made mutable to allow for new registries to be added.