Skip to content

Remove remaining pseudo dependency of E4-Injector to jakarta annotations#2649

Merged
HannesWell merged 2 commits into
eclipse-platform:masterfrom
HannesWell:remove-injector-pseudo-dependency
Jun 2, 2026
Merged

Remove remaining pseudo dependency of E4-Injector to jakarta annotations#2649
HannesWell merged 2 commits into
eclipse-platform:masterfrom
HannesWell:remove-injector-pseudo-dependency

Conversation

@HannesWell

@HannesWell HannesWell commented May 4, 2026

Copy link
Copy Markdown
Member

This ensures that the E4-Injector does not work with any specific annotation class.

The pseudo dependency was introduced when resolving Bug 301462, but just returning an empty array as dependencies of the ClassRequestor also passes the then added DisposeClassLinkTest.
I stepped through the code a bit when using the ClassRequestor and the pseudoVariable doesn't seem to have an effect.
Or does anyone know a reason to keep it?

Follow-up on

org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning

@HannesWell HannesWell May 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Even with invalidJavadoc turned to warning the javadoc links below report errors because the jakarta.annotation/inject annotations are not accessible anymore.
The only way I found to silence the errors was to add them back as additional.bundles in the build.properties below.
Does anyone know a JDT preference to ignore inaccessible types in javadoc? Or is this a bug?

@laeubi laeubi May 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

eclipse-jdt/eclipse.jdt.core#4923

Apart from that I think the javadoc references are not that valuable so we can remove them if needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the pointer.

Apart from that I think the javadoc references are not that valuable so we can remove them if needed.

Yes, they are not essential. But I think they're nice to have and if possible, I'd like to retain them

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   36m 23s ⏱️ + 1m 36s
 4 667 tests ±0   4 645 ✅ ±0   22 💤 ±0  0 ❌ ±0 
11 895 runs  ±0  11 742 ✅ ±0  153 💤 ±0  0 ❌ ±0 

Results for commit d7d0151. ± Comparison against base commit 7f435dc.

♻️ This comment has been updated with latest results.

@akurtakov

Copy link
Copy Markdown
Member

That way the DI will not make sure there is at least one annotation provider - it opens the door for products crafted with either javax or jakarta or both or none even.
This might have the implication that target platforms will have neither thus projects need modifications in their target platforms in order to migrate to new eclipse version.

@laeubi

laeubi commented May 5, 2026

Copy link
Copy Markdown
Contributor

The pseudo dependency was introduced when resolving Bug 301462, but just returning an empty array as dependencies of the ClassRequestor also passes the then added DisposeClassLinkTest.

Sadly the bugzilla link is inaccessible - do you have a copy of what this is talking about?

I stepped through the code a bit when using the ClassRequestor and the pseudoVariable doesn't seem to have an effect.

Is this maybe somewhere else used (e.g. via reflection?) as it is a public static field ... it might be used for some kind of triggering a (reinjection) of dependencies.

@HeikoKlare HeikoKlare force-pushed the remove-injector-pseudo-dependency branch from 55a1c43 to 6ff7e39 Compare May 5, 2026 12:01
@HannesWell

HannesWell commented May 5, 2026

Copy link
Copy Markdown
Member Author

The pseudo dependency was introduced when resolving Bug 301462, but just returning an empty array as dependencies of the ClassRequestor also passes the then added DisposeClassLinkTest.

Sadly the bugzilla link is inaccessible - do you have a copy of what this is talking about?

Bugzilla seems to have had some temporary issues today. It was available when I wrote the comment and is now available again for me. But besides that the resolving commit might provide more context: 6cf3c7c

I stepped through the code a bit when using the ClassRequestor and the pseudoVariable doesn't seem to have an effect.

Is this maybe somewhere else used (e.g. via reflection?) as it is a public static field ... it might be used for some kind of triggering a (reinjection) of dependencies.

I didn't find any such reflective reference. And something like that was also not done in the commit that introduced that class. My assumption is that it was just added to return a non empty array in calcDependentObjects().
But as far as I can tell, just returning an empty array seems to have no drawbacks. The DisposeClassLinkTest, introduced with 6cf3c7c, still passes.

@HannesWell

Copy link
Copy Markdown
Member Author

That way the DI will not make sure there is at least one annotation provider - it opens the door for products crafted with either javax or jakarta or both or none even. This might have the implication that target platforms will have neither thus projects need modifications in their target platforms in order to migrate to new eclipse version.

That's in theory correct, but the other very basic e4-core/di Plug-ins still require it:
grafik

Therefore I'd assume that the chances are relatively low that one can really avoid the jakarta annotation bundles or that one would not have them in the in the TP transitively. But the chances are not zero.

My primary goal was to make the o.e.e4.core.di independent from any specific annotation package in order to ensure by design that it doesn't rely on specific class instances but just relies on names.

This ensures that the E4-Injector does not work with any specific
annotation class.
@HannesWell HannesWell force-pushed the remove-injector-pseudo-dependency branch from 459844e to 2b09a92 Compare May 30, 2026 04:33
@eclipse-platform-bot

Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 131684691742b0bc37deecdedaa7d3bce5b11745 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Sat, 30 May 2026 04:37:50 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF b/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF
index fa1bd583a4..16709d0eaf 100644
--- a/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF
+++ b/runtime/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.eclipse.e4.core.di
-Bundle-Version: 1.9.800.qualifier
+Bundle-Version: 1.9.900.qualifier
 Bundle-Name: %pluginName
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
-- 
2.54.0

Further information are available in Common Build Issues - Missing version increments.

@HannesWell

Copy link
Copy Markdown
Member Author

I've now replaced the currently erroring JavaDoc links by code elements, which could be reverted when the JavaDoc processing in ECJ is less strict.

I stepped through the code a bit when using the ClassRequestor and the pseudoVariable doesn't seem to have an effect.

Is this maybe somewhere else used (e.g. via reflection?) as it is a public static field ... it might be used for some kind of triggering a (reinjection) of dependencies.

I didn't find any such reflective reference. And something like that was also not done in the commit that introduced that class. My assumption is that it was just added to return a non empty array in calcDependentObjects(). But as far as I can tell, just returning an empty array seems to have no drawbacks. The DisposeClassLinkTest, introduced with 6cf3c7c, still passes.

My proposal is to submit this soon, so we would have sufficient time for fixes in case the conclusion is wrong that this is a save change.

@akurtakov

Copy link
Copy Markdown
Member

I agree, please merge as soon as you're comfortable with the change to get as big testing window as possible.

@HannesWell HannesWell merged commit a569c2c into eclipse-platform:master Jun 2, 2026
18 checks passed
@HannesWell HannesWell deleted the remove-injector-pseudo-dependency branch June 2, 2026 18:36
@vogella

vogella commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

I think this causes the failing test in the I-Build.

org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests	testBut336225()	Failure	The shell should not have been disposed first ==> expected: <false> but was: <true>

org.opentest4j.AssertionFailedError: The shell should not have been disposed first ==> expected: <false> but was: <true>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertFalse.failNotFalse(AssertFalse.java:63)
at org.junit.jupiter.api.AssertFalse.assertFalse(AssertFalse.java:36)
at org.junit.jupiter.api.Assertions.assertFalse(Assertions.java:239)
at org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests.testBut336225(PartRenderingEngineTests.java:1751)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

I assume the pseudoVariable has a influence in the ordering of @PreDestroy

akurtakov added a commit to akurtakov/eclipse.platform that referenced this pull request Jun 4, 2026
PR eclipse-platform#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 eclipse-platform#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 eclipse-platform#2649)
while re-establishing the supplier-disposal link.

Fixes eclipse-platform#2700
akurtakov added a commit to akurtakov/eclipse.platform that referenced this pull request Jun 4, 2026
PR eclipse-platform#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 eclipse-platform#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 eclipse-platform#2649)
while re-establishing the supplier-disposal link.

Fixes eclipse-platform#2700
HannesWell pushed a commit to akurtakov/eclipse.platform that referenced this pull request Jun 4, 2026
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

Copy link
Copy Markdown
Member Author

I assume the pseudoVariable has a influence in the ordering of @PreDestroy

Yes, that seems to be the case.

The pseudo dependency was introduced when resolving Bug 301462, but just returning an empty array as dependencies of the ClassRequestor also passes the then added DisposeClassLinkTest.

At the same time, it seems that that test is not sufficient to cover all cases and should be enhanced. But I don't know all details from the test that failed...

HannesWell pushed a commit that referenced this pull request Jun 4, 2026
The E4 Injector was decoupled from jakarta annotations by replacing
the ClassRequestor pseudo-dependency descriptor with an empty array, in:
- #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 #2700
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.

5 participants