-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make javax-annotations optional for E4 Injector #792
Conversation
5787e93
to
a05089c
Compare
a05089c
to
fdcb694
Compare
fdcb694
to
8ce8931
Compare
With the Addition of dedicated javax and jakarta Tests in#791 this now ready and reviews are more than welcome. The only think left is to add a special test-case to the Jakarta Tests to ensure that the javax-classes are really absent in the test runtime. |
8ce8931
to
c503887
Compare
@laeubi, @akurtakov, @mickaelistria or anybody else, do you want to review this or have any opnion about when to merge this (now or next release cycle)?
Added this now, but I'm not sure if that will work in I-builds, but maybe we have to try that out. |
Do it now. If there are problems we know we can count on you to fix them. |
Then I'll fix the test and submit this on Friday evening so that I have time on the weekend to fix potential early regressions. |
c503887
to
fe7a07c
Compare
static final AnnotationProxy PRE_DESTROY = createProxyForClasses(jakarta.annotation.PreDestroy.class, | ||
() -> javax.annotation.PreDestroy.class); | ||
public static final AnnotationProxy POST_CONSTRUCT = createProxyForClasses(jakarta.annotation.PostConstruct.class, | ||
() -> javax.annotation.PostConstruct.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't javax fail at runtime when javax is not present due to optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. But that is why this class is wrapped into a supplier, which is called in a try-catch block that catches NoClassDefFoundErrors.
The e4.core.tests explicitly got a case added to ensure that the javax.inject/annotation
classes are not available in those tests-runtime so that a failure due to absense of those classes would show up in any of those tests.
And to ensure javax still works #791 was added.
fe7a07c
to
50ae8be
Compare
Rework the E4 InjectorImpl and introduce the AnnotationLookup class to handle a potential absence of javax-annotations at runtime. Print a warning if the 'old' javax-annotations are available at runtime to encourage users to migrate. The warning can be suppressed with the VM-property -Declipse.e4.inject.javax.warning=false Make the remaining imports of javax.inject/annotation packages optional. Annotations who's classes cannot be loaded at runtime are silently ignored by the JVM, as if they where not declared. Part of eclipse-platform/eclipse.platform.releng.aggregator#1056
50ae8be
to
2cc7b9f
Compare
@HannesWell could this cause eclipse-mwe/mwe#275 |
I can neither confirm nor negate that with confidence yet, but as far as I can see nothing mentions javax. |
ENTRY org.eclipse.tycho.surefire.junit4 2 0 2023-11-04 07:30:50.192 |
Many JDT tests did not run at all with https://download.eclipse.org/eclipse/downloads/drops4/I20231103-1800. Looks like sue javax errors, see for example https://download.eclipse.org/eclipse/downloads/drops4/I20231103-1800/testresults/ep430I-unit-cen64-gtk3-java17_linux.gtk.x86_64_17/directorLogs/director-org.eclipse.jdt.core.tests.model.log
|
Should we mark lst build unstable? |
Some things to note. The bundle is in the update site: And in the target platform: So the question arises, why would the package not be found when it's available in both places where one would expect to look. |
I was asking myself the same. |
Because it is not a requirement of the test runtime but of As a first test I would just add an extra requirement to the tycho-build ... not sure how to archive this for the eclipse-test-framework. |
I was referring to
Looks like I forgot platform.swt when migrating javax to jakarta.
For JDT I created eclipse-jdt/eclipse.jdt.core#1527 already, but it probably needs adjustments and didn't get any attention yet.
I'll check why that's the case, but with recent Tycho that issue seems to be gone since this PR passed as well. |
Important parts in bold ;-)
|
Now that the following PRs are merged
should I trigger an I-build again to see if the JDT tests work again and see if also the javax.inject providing bundle is gone as an ultimate test to be sure there is no dependency anymore. |
Yes, please |
Just started the 100th I-build for 4.30: |
With the mentioned PRs no This is a good news since it confirms that they are not required anymore (only optionally required by the e4 bundles that have optional support for it). I just created eclipse-platform/eclipse.platform.releng.aggregator#1509 to ensure it is added back to the repo until we remove support for javax entirely. |
Rework the E4
InjectorImpl
and introduce theAnnotationLookup
class to handle a potential absence of javax-annotations at runtime.Print a warning if the 'old' javax-annotations are available at runtime to encourage users to migrate.
The warning can be suppressed with the VM-property
-Declipse.e4.inject.javax.warning=false
.Make the remaining imports of javax.inject/annotation packages optional.
Annotations who's classes cannot be loaded at runtime are silently ignored by the JVM, as if they where not declared.
Alternatively we could simply remove the javax meta-annotations applied to E4 annotations since the E4 injector can handle the jakarta-pendants. It would just be a break in case there are other tools out there that process those E4 annotations (like
org.eclipse.e4.core.di.extensions.OSGiBundle
ororg.eclipse.e4.core.di.extensions.EventTopic
). But I cannot access if that's the case.Part of eclipse-platform/eclipse.platform.releng.aggregator#1056
This currently also includes the addition of separate javax-annotation tests in #791.