Skip to content

Fix binary-incompatible getMemberSet() return type and AddonClassLoader recursive update#2836

Merged
tastybento merged 2 commits intodevelopfrom
worktree-immutableset-compat-and-classloader-fix
Mar 9, 2026
Merged

Fix binary-incompatible getMemberSet() return type and AddonClassLoader recursive update#2836
tastybento merged 2 commits intodevelopfrom
worktree-immutableset-compat-and-classloader-fix

Conversation

@tastybento
Copy link
Member

Summary

  • Restore ImmutableSet<UUID> return type on Island.getMemberSet() overloads — a prior commit changed these to Set<UUID> to satisfy SonarCloud S4738, but this is a binary-incompatible API change: addons compiled against any prior BentoBox version will throw NoSuchMethodError at runtime because the JVM encodes the return type in the method descriptor. Reverted to ImmutableSet<UUID> with @SuppressWarnings("java:S4738") and an explanatory comment.
  • Fix IllegalStateException: Recursive update in AddonClassLoadercomputeIfAbsent() on ConcurrentHashMap throws when class loading re-enters findClass() for dependent classes. Replaced with an explicit get → compute → put pattern that does not hold the map's lock during class loading. This was causing DimensionalTrees (and likely other addons with cross-addon class dependencies) to fail on load.
  • Fix failing test IslandTeamInviteGUITest.testBackButtonClick_notInviteCmd_closesInventory — added missing command mocks (kickCommand, setOwnerCommand, leaveCommand, acceptCommand) needed when the back button builds an IslandTeamGUI; also stubbed the newly-typed getMemberSet(int) / getMemberSet(int, boolean) overloads in CommonTestSetup since Mockito no longer auto-stubs ImmutableSet with an empty collection.

Test plan

  • ./gradlew build passes (2188 tests, 0 failures)
  • javap confirms getMemberSet descriptors are ()Lcom/google/common/collect/ImmutableSet; (binary-compatible with all prior addon JARs)
  • DimensionalTrees and other addons using cross-addon class loading should no longer throw IllegalStateException: Recursive update on startup

🤖 Generated with Claude Code

tastybento and others added 2 commits March 8, 2026 17:34
…bility

Commit d244c40 changed getMemberSet() overloads from ImmutableSet<UUID> to
Set<UUID> to satisfy SonarCloud S4738. This is a binary-incompatible API change:
addons compiled against any prior BentoBox version will throw NoSuchMethodError
at runtime because the JVM encodes the return type in the method descriptor.

Reverts to ImmutableSet<UUID> with @SuppressWarnings("java:S4738") and a comment
explaining the rationale. Also stubs the two newly-typed overloads in
CommonTestSetup (Mockito no longer auto-stubs ImmutableSet with an empty set)
and adds missing itc command mocks to IslandTeamInviteGUITest so the
testBackButtonClick_notInviteCmd_closesInventory test passes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ConcurrentHashMap.computeIfAbsent() throws IllegalStateException when a nested
call tries to compute another entry while an outer computation is in progress.
This happened because super.findClass() triggers loading of dependent classes,
which re-enter findClass() and call computeIfAbsent() on the same map.

Replace computeIfAbsent with an explicit get → compute → put pattern that does
not hold the map's internal lock during class loading, eliminating the recursive
update. Guava ImmutableSet and similar classes with cross-addon dependencies
were causing DimensionalTrees (and likely other addons) to fail on load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tastybento tastybento merged commit 9a4e960 into develop Mar 9, 2026
1 check passed
@tastybento tastybento deleted the worktree-immutableset-compat-and-classloader-fix branch March 9, 2026 00:35
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

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.

1 participant