Skip to content

Refactor command argument checks and enhance null safety in various c…#2807

Merged
tastybento merged 2 commits intodevelopfrom
static-code-analysis-changes
Mar 1, 2026
Merged

Refactor command argument checks and enhance null safety in various c…#2807
tastybento merged 2 commits intodevelopfrom
static-code-analysis-changes

Conversation

@tastybento
Copy link
Member

…lasses

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors several utility, command, and panel classes to simplify logic, remove unused code/imports, and strengthen nullability contracts (notably via JDT @NonNull and Java 21 SequencedCollection APIs) across the BentoBox codebase.

Changes:

  • Replace manual “last element” indexing with Java 21 getFirst/getLast/removeLast in placeholder grouping and navigation.
  • Add/adjust @NonNull annotations and implement value-based equals/hashCode for expiring collection wrappers.
  • Simplify a few boolean checks and remove unused imports/modifiers.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/world/bentobox/bentobox/util/Util.java Removes unused import.
src/main/java/world/bentobox/bentobox/util/PlaceholderGrouper.java Uses getFirst/getLast for sorted index bounds.
src/main/java/world/bentobox/bentobox/util/ExpiringSet.java Adds @NonNull type-use annotations; refines equals.
src/main/java/world/bentobox/bentobox/util/ExpiringMap.java Adds @NonNull annotations; adds equals/hashCode.
src/main/java/world/bentobox/bentobox/panels/PlaceholderListPanel.java Uses removeLast/getLast for navigation path handling.
src/main/java/world/bentobox/bentobox/panels/CatalogPanel.java Removes unused import.
src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java Simplifies overlap check boolean logic.
src/main/java/world/bentobox/bentobox/managers/IslandDeletionManager.java Removes unused list used during startup deletion scan.
src/main/java/world/bentobox/bentobox/lists/Flags.java Removes redundant final from static method.
src/main/java/world/bentobox/bentobox/hooks/placeholders/PlaceholderAPIHook.java Removes unused import.
src/main/java/world/bentobox/bentobox/hooks/OraxenHook.java Simplifies plugin presence check.
src/main/java/world/bentobox/bentobox/commands/BentoBoxRankCommand.java Simplifies tab-complete branching conditions.
src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintTrialSpawner.java Adds @NonNull to loot table map accessors; adjusts toString.
src/main/java/world/bentobox/bentobox/blueprints/Blueprint.java Removes fallback initialization in getName().
src/main/java/world/bentobox/bentobox/api/panels/reader/PanelTemplateRecord.java Marks toString() as @NonNull.
src/main/java/world/bentobox/bentobox/api/configuration/ConfigObject.java Removes unused import.
src/main/java/world/bentobox/bentobox/api/commands/CompositeCommand.java Adds array type-use nullability annotations for args.
src/main/java/world/bentobox/bentobox/api/addons/exceptions/InvalidAddonFormatException.java Adds suppression annotation for printStackTrace().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 1, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@tastybento tastybento merged commit 70b40a0 into develop Mar 1, 2026
2 of 3 checks passed
@tastybento tastybento deleted the static-code-analysis-changes branch March 1, 2026 23:49
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.

2 participants