[4.0.x] Bump Sisu to 1.1.0 and fix extension realm visibility for JSR330 filtering - #12556
[4.0.x] Bump Sisu to 1.1.0 and fix extension realm visibility for JSR330 filtering#12556gnodet wants to merge 3 commits into
Conversation
…ering Sisu 1.1.0 adds JSR330 bean visibility filtering based on ClassRealm hierarchy (jsr330ComponentVisibilityFollowsPlexusVisibility, on by default). When TCCL is an extension realm during lifecycle callbacks, Sisu's FilteredBeans calls RealmManager.computeVisibleNames() which traverses parent and import realms via BFS. Extension realms have plexus.core as parent but beans discovered in the container are sourced from the maven.ext realm. Since extension realms had no import relationship to maven.ext, container-sourced beans were incorrectly filtered out. This caused failures with extensions like Mimir that register lifecycle listeners: when the listener's callback triggered a Sisu dynamic map access (e.g., NameMapper resolution), the beans were invisible from the extension's realm, resulting in "Unknown NameMapper name" errors. The fix adds a reverse import from each extension realm to the container realm (maven.ext), following the same pattern already used for the forward direction (maven.ext imports from extension realms). This makes maven.ext reachable in Sisu's visibility BFS traversal, so container-sourced beans remain visible regardless of TCCL context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
left a comment
There was a problem hiding this comment.
✅ Clean cherry-pick backport of #12554 to maven-4.0.x. The diff is byte-identical to the master PR.
Sisu 1.1.0 bump — straightforward version update.
Realm visibility fix — the new reverse import (realm.importFrom(extRealm, extRealm.getId())) correctly makes container-sourced beans visible from extension realms. Key observations:
- Correctly placed outside the
if (exportedPackages.isEmpty())guard — all extensions need container bean visibility regardless of export config - No circular import risk: ClassRealm imports are non-transitive directional lookups, and Sisu's BFS uses a visited set
- All 24 CI checks pass green across all platforms and JDK versions
Minor note (non-blocking): No dedicated test for the reverse import behavior — it's validated by the full integration suite (581+ tests), but a targeted test would guard against future regressions if realm setup is refactored.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
gnodet
left a comment
There was a problem hiding this comment.
New commit adds the same regression IT (MavenITgh12522NonExtensionPluginTest) as the master PR — verifying non-extension plugins with JSR330 components don't break builds. Good backport of the test. Prior APPROVE still stands.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
Regression test verifying that plugins NOT marked with <extensions>true</extensions> do not cause build failures when they ship JSR330 components whose internal dependencies cannot be resolved in Maven's container. Uses tycho-bnd-plugin as the reproducer. With Sisu 1.1.0's jsr330ComponentVisibilityFollowsPlexusVisibility, non-extension plugin components are filtered out of container-realm JSR330 lookups, preventing the provisioning error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48e139f to
86c1337
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Backport of #12554 to
maven-4.0.x.Root Cause
Sisu 1.1.0 introduces
jsr330ComponentVisibilityFollowsPlexusVisibility(on by default), which filters beans based on ClassRealm visibility viaRealmManager.computeVisibleNames(). This BFS traversal walks parent and import realms from the current TCCL.Extension realms have
plexus.coreas their parent, but beans discovered in the container are sourced from themaven.extrealm. Since extension realms had no import relationship tomaven.ext, container-sourced beans were incorrectly filtered out when TCCL was set to an extension realm during lifecycle callbacks (e.g., Mimir extension).Fix
Adds a reverse import from each extension realm to the container realm (
maven.ext), using the sameimportFrom(realm, realm.getId())pattern already used for the forward direction. This works with Sisu 1.1.0's filtering feature — the realm visibility graph is corrected to reflect the actual relationship between extension and container realms.Verified
mvn clean install -DskipTestspasses on 4.0.xmvn verify -pl impl/maven-clipasses (581 tests, 0 failures)🤖 Generated with Claude Code