Repository navigation
fix: JSR330 filtering fix - #13582
Conversation
Maven Core Extensions are having JSR330 filtering applied as well, but alas, when they are present, class realm layout changes a bit and visibility becomes invisibility. Using Sisu latest API to basically turn off filtering for JSR330 beans (so making it happen the very same as it was in Maven 3.9) when it comes to Maven Core Extensions.
c6dcb84 to
c1ae5ea
Compare
gnodet-bot
left a comment
There was a problem hiding this comment.
This PR adds Sisu Maven Plugin 1.1.1-SNAPSHOT (pom.xml line 129) and two snapshot repositories (central-portal-snapshots) to fetch it. It cannot be merged until Sisu 1.1.1 is released and the SNAPSHOT reference + repository blocks are removed.
Next step: Wait for eu.maveniverse.sisu:sisu-maven-plugin:1.1.1 to be available on Central, then update the version and drop the snapshot repository blocks.
The fix changes filtering logic in BootstrapCoreExtensionManager (JSR330 visibility filtering is bypassed when the TCCL is a core extension realm), restoring Maven 3.9 behavior — but there is no test that reproduces the original failure. Without a regression test, a future refactor could silently reintroduce the bug.
Suggestion: Add an IT that loads a core extension with a JSR330 component and verifies it can be injected without NoSuchBeanDefinitionException.
💡 Javadoc inaccuracy in contextRealm() (MavenCli.java)
The Javadoc says:
"Helper method to return current TCCL set
ClassRealmornull, if TCCL is not a class realm."
But the implementation walks the parent chain:
for (ClassLoader tccl = Thread.currentThread().getContextClassLoader(); tccl != null; tccl = tccl.getParent()) {
if (tccl instanceof ClassRealm) {
return (ClassRealm) tccl;
}
}This returns a ClassRealm if any ancestor of the TCCL is one — not just the direct TCCL itself. The Javadoc should reflect that: e.g. "Returns the first ClassRealm found in the TCCL parent chain, or null if none is found."
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — 1 of 3 issues has been addressed.
✅ Javadoc inaccuracy in contextRealm() — fixed. The new Javadoc accurately states "Returns the first ClassRealm found in the TCCL parent chain, or null if none is found." The refactoring of realm-detection logic into BootstrapCoreExtensionManager (with the CORE_EXTENSION_REALM_NAME_PREFIX constant) is a clean improvement. The CORE_EXTENSION_REALM_NAME_PREFIX = "coreExtension>" constant is used consistently — no remaining hardcoded occurrences in the class.
✅ Core design verified. I cross-checked the Sisu FilteredBeans semantics: when the transformed supplier's .get() returns null, FilteredBeans.iterator() falls through to the unfiltered beans.iterator(). This is the documented mechanism to disable JSR330 filtering per-realm and precisely matches the intent of restoring Maven 3.9 behavior for core extensions. The TCCL-based check is thread-safe — Thread.currentThread().getContextClassLoader() is per-thread, and the parent-chain walk reads the immutable classloader hierarchy.
sisu-maven-plugin 1.1.1-SNAPSHOT and the central-portal-snapshots repository blocks remain in pom.xml. Even though sisu-project#275 is now merged, sisu 1.1.1 has not been released yet. This PR cannot be merged until sisu 1.1.1 is out on Central and the snapshot reference + repository blocks are removed.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sisu is filtering for us, even injected collections. Magic.
gnodet-bot
left a comment
There was a problem hiding this comment.
Re-reviewing after the latest commits. Two issues remain.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — 1 of 2 open issues has been addressed.
✅ isEnabled() filtering in DefaultLifecycles.java — addressed. The removeIf(e -> !isEnabled(e.getKey())) call correctly preserves the maven.site.lifecycle.disabled behavior, and the new testSiteLifecycleDisabled unit test validates it end-to-end (sets the system property, verifies only clean and default remain). I cross-checked: DefaultLifecyclePluginAnalyzer is unrelated to this check — the isEnabled() gate only applies to lifecycle phases, not packaging-to-lifecycle mappings, so no symmetrical fix is needed there.
sisu-maven-plugin 1.1.1-SNAPSHOT and the central-portal-snapshots repository blocks remain in pom.xml. Sisu 1.1.1 has not been released yet (current latest on Central is 1.1.0, released July 2026). This PR cannot be merged until 1.1.1 is out on Central and the SNAPSHOT reference + repository blocks are removed.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
Re-review after latest commits. The SNAPSHOT dependency is resolved and missing tests are now added — both prior blocking issues addressed. Two minor suggestions below.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
All previously-raised review threads are now addressed. ✅
What's new in this push:
- Defensive
lifecycle == nullcheck added inDefaultLifecycles.javawith explanatory comment BootstrapCoreExtensionManagerTest.javaexpanded to 6 test scenarios covering ClassRealm hierarchy cases
One remaining blocker: Spotless formatting
The new test file has a Palantir Java format violation that fails CI. Fix with:
mvn spotless:apply -pl maven-embedder
Also: Duplicate PR #13584 covers the same fix and should be closed.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
All previously-raised review findings are now resolved. ✅
What's new in this push:
- "Reformat" commit (f98ac41) runs
spotless:applyonBootstrapCoreExtensionManagerTest.java— one line unwrapped to satisfy Palantir Java Format. No semantic change.
Summary of prior findings (all addressed):
- ✅ SNAPSHOT dependency (
sisu-maven-plugin 1.1.1-SNAPSHOT) → resolved (1.1.1 released, now on Central) - ✅ Missing regression test →
BootstrapCoreExtensionManagerTest.javaadded (6 test scenarios) - ✅
isEnabled()filtering lost inDefaultLifecycles→ fixed withremoveIf - ✅ Javadoc inaccuracy in
contextRealm()→ fixed - ✅ Spotless formatting violation in test file → fixed by this Reformat commit
Housekeeping note: PR #13584 by @charangowdamd-cmd ("[3.10.x] Fix #13583: Allow core extensions to see container components with Sisu 1.1.0") is still open and duplicates this fix. A maintainer should close it as superseded.
LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
I think this caused https://lists.apache.org/thread.html/g47zd1kvtj4wmmr8l3q22o896p55s7x8 - where groovy-eclipse-compiler registered as extension (https://github.com/groovy/groovy-eclipse/wiki/groovy-eclipse-maven-plugin#use-the-groovy-eclipse-compiler-mojo-for-configuring-source-folders) has no That worked fine in 3.10.0 and previously in 3.9.16 as well. |
Maven Core Extensions are having JSR330 filtering applied as well, but alas, when they are present, class realm layout changes a bit and visibility becomes invisibility. Using Sisu latest API to basically turn off filtering for JSR330 beans (so making it happen the very same as it was in Maven 3.9) when it comes to Maven Core Extensions.
Also, remove a forgotten "plexus dance", as today, with JSR330 filtering, it is not needed anymore.
Depends on eclipse-sisu/sisu-project#275
Fixes: #13583