Skip to content

feat: add boss bar viewer#1756

Draft
RealBauHD wants to merge 3 commits intoPaperMC:dev/3.0.0from
RealBauHD:feat/boss-bar-viewer
Draft

feat: add boss bar viewer#1756
RealBauHD wants to merge 3 commits intoPaperMC:dev/3.0.0from
RealBauHD:feat/boss-bar-viewer

Conversation

@RealBauHD
Copy link
Copy Markdown
Contributor

No description provided.

@RealBauHD RealBauHD marked this pull request as draft March 28, 2026 16:25
@WouterGritter
Copy link
Copy Markdown
Contributor

Why does Set<BossBar> bossBars need to be monotonically non-null? Seems like no real performance gain for less readability.

}

@Override
public @UnmodifiableView @org.jspecify.annotations.NonNull Iterable<? extends BossBar> activeBossBars() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public @UnmodifiableView @org.jspecify.annotations.NonNull Iterable<? extends BossBar> activeBossBars() {
public @UnmodifiableView @NonNull Iterable<? extends BossBar> activeBossBars() {

org.checkerframework.checker.nullness.qual.NonNull is imported

@Timongcraft
Copy link
Copy Markdown
Contributor

Why does Set<BossBar> bossBars need to be monotonically non-null? Seems like no real performance gain for less readability.

What are you talking about?
For me at least it is Nullable:
https://github.com/PaperMC/Velocity/pull/1756/changes#diff-1cd097c1de92fff8c43bc33eb4f52405eb5396f9e8cc922a4502e4cad12e1f88R189

@WouterGritter
Copy link
Copy Markdown
Contributor

Why does Set<BossBar> bossBars need to be monotonically non-null? Seems like no real performance gain for less readability.

What are you talking about? For me at least it is Nullable: https://github.com/PaperMC/Velocity/pull/1756/changes#diff-1cd097c1de92fff8c43bc33eb4f52405eb5396f9e8cc922a4502e4cad12e1f88R189

yes but you're treating it as a monotonically non-null value. we can just leave it as a

private final Set<BossBar> bossBars = new HashSet<>();

and omit any null checks down the line. keeping this value null until it's used doesn't seem like it'll affect performance at all, and it makes the code that's using this field less readable (null -> either instantiate this set when modifying it, or assuming an empty set when querying it)

@Timongcraft
Copy link
Copy Markdown
Contributor

@WouterGritter
Copy link
Copy Markdown
Contributor

They don't though (https://github.com/PaperMC/Velocity/pull/1756/changes#diff-1cd097c1de92fff8c43bc33eb4f52405eb5396f9e8cc922a4502e4cad12e1f88R613), or am I missing something?

oh yes my bad, its not monotonically non-null, but my point still holds. this can be a HashSet that's initiated once (at construct time of the object) and only updated/queried without null-checks. that'd get rid of null-checks in every method that's using this field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants