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
Require-Bundle javax.inject #2176
Comments
we currently use the google inject annotation and injector class at 1 billion places. so the require wont be sufficient beside util its also used in test bundles as import package |
It's worse: I think this needs some more analysis. |
@jukzi @szarnekow can package import be reexported? |
A bundle can export it's imported packages, even though the UI does not allow it. The OSGI spec has rules how that situation will be resolved, though. I'm not terribly sure about that approach though, since it's certainly prone to confusion. |
by non-OSGI do you mean plain Maven/Gradle project? In that case, you can exclude the dependency |
sadly it's not that easy for us. |
Not as far as I know.
It is more the other way round, a bundle can import the packages it exports. In general a Bundle can only export what is contained in the bundle.
As far as I can tell there will be no way around that, if that issue should be addressed. This is one of the main the reason why reexported require-bundle is strongly discouraged and require bundle is also discouraged, although it might seem to be more convenient at first sight. |
I suggest when Xtext has migrated to For platform I started the migration, first only to the javax-annotations provided by jakarta and eventually to jakarta-annotations: eclipse-platform/eclipse.platform.releng.aggregator#1056 And when Xtext requires that release IMHO it would be a good point to make the switch. |
we still need javax.inject for 2023-06 as i dont think we get this updated so soon on our with the capacity i see. |
If you are willing to potentially break down stream projects it would be sufficient to change the Require-bundle javax.inject to Import-Package When Xtext migrates to jakarta annotations that should not be another break for down-stream consumers, since it is an internal change. Btw. if Xtext migrates to jakarta.inject/annotations I would also migrate the the google.inject annotations to jakarta (although they are used very much). |
i fear this will also break all internal projects |
Understand.
Regarding this suggestion, coincidentally we had a bug-report just this evening that shows that it would probably work (see eclipse-platform/eclipse.platform.ua#122). |
for that we need to check what works. at some places we reject usage of the javax annotation |
The two Inject annotations are not completely interchangeable: https://github.com/google/guice/wiki/JSR330 |
yes this is what i saw some special threatment for |
…inject to jakarta.inject in guice Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
[#2176] use guice namespace annotations to prepare switch from javax.inject to jakarta.inject in guice
for now i changed the code to use guices annotations consistently. so it will work with and without javax.annotation present |
Since the only Require-Bundle header that mentions javax.inject marks the requirement as optional (as mentioned in #2176 (comment)) I think that change resolves this issue. If somebody relies on the reexport just adding @jukzi can you test a current nightly? If that requirement should be deprecated one day PDE could probably help in the future: eclipse-pde/eclipse.pde#406 |
I don't see what changed for us. As long as there is an javax.inject import our build system will add it :-( |
What do you refer to by |
sorry i meant "Require-Bundle:" even if optional |
In that case, I'm afraid there's not much we can do within the boundaries of Xtext's backward compatibility guarantees. Your tool is not using a regular OSGI resolver, I guess? Or it is resorting to greedy resolution of dependencies? |
What build system do you use? Maven+Tycho? If yes, we could consider to not fail the resolution if a optional dependency is missing. This would also make #2219 work. |
I highly appreciate your offer to help, but currently for us there is no simple way to migrate towards any ordinary build tool. |
I would like to discuss the compatibility thing together with the guice and guava update. Right now we have 3 discussion in parallel |
obsolete with guice and guava update in 2.32 |
Instead of using "Require-Bundle" could you please use "Import-Package" for javax.inject
We currently try to use a Non-OSGi java where libraries should not conflict but
bundle javax.inject conflicts with jakarta.inject which is normally used for that package. As far as i know org.eclipse.xtext.util is the only lib that explicitly requests javax.inject.
https://github.com/eclipse/xtext-core/blob/0ca980145ddb04780e6e898a023458782e734977/org.eclipse.xtext.util/META-INF/MANIFEST.MF#L48
The text was updated successfully, but these errors were encountered: