Restore supplier-disposal link in ClassRequestor without jakarta#2707
Merged
Conversation
Contributor
The E4 Injector was decoupled from jakarta annotations by replacing the ClassRequestor pseudo-dependency descriptor with an empty array, in: - eclipse-platform#2649 That pseudo-link is what notifies an injected object when its supplier is disposed. With an empty descriptor the link is no longer established, so @PreDestroy of objects that only use constructor/@PostConstruct injection (no @Inject links) is no longer guaranteed to run before the supplying context is disposed. This broke disposal ordering and surfaced as a failure of PartRenderingEngineTests.testBut336225. Restore a non-empty, optional descriptor without re-introducing jakarta: use a private marker interface InjectionLink that is never available from any supplier together with e4's own @optional annotation. This keeps the injector free of specific jakarta annotation classes (the goal of the previous change) while re-establishing the supplier-disposal link. Fixes eclipse-platform#2700
HannesWell
approved these changes
Jun 4, 2026
Member
There was a problem hiding this comment.
Thank you Alex.
I was able to verify locally that this fixes the test in question.
Furthermore I tried to simplify this and to avoid the PSEUDO_VARIABLE, by creating the used types directly. But for the Annotation instantiation this was eventually not simpler.
So I just made the code and comments a bit less verbose, as we discussed in private.
Will submit this once the build is ready to have the test failure fixed with tonight’s I-build.
And since it's similar to the state from #2649, I think there is not much discussion necessary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #2649 decoupled the E4 injector from jakarta annotations by replacing the ClassRequestor pseudo-dependency descriptor with an empty array. That pseudo-link is what notifies an injected object when its supplier is disposed. With an empty descriptor the link is no longer established, so @PreDestroy of objects that only use constructor/@PostConstruct injection (no @Inject links) is no longer guaranteed to run before the supplying context is disposed.
This broke disposal ordering and surfaced as a failure of PartRenderingEngineTests.testBut336225 ("The shell should not have been disposed first"), reported in #2700.
Restore a non-empty, optional descriptor without re-introducing jakarta: use a private marker interface InjectionLink that is never available from any supplier together with e4's own @optional annotation. This keeps the injector free of specific jakarta annotation classes (the goal of #2649) while re-establishing the supplier-disposal link.
Fixes #2700