Make Google Guava bundles as singletons ? [message #1102202] |
Thu, 05 September 2013 14:01 |
Maxence Vanbesien Messages: 10 Registered: October 2009 |
Junior Member |
|
|
Hello,
I have just one question, related to the use of the org.google.guava bundles that are proposed through Eclipse Orbit.
Lately, I got an issues that came to the fact that there were both versions 10.0.1 and 13.0.0 installed on my computer...
This lead to the following issue (I'm developing upon MDT Papyrus)
org.eclipse.e4.core.di.InjectionException: java.lang.LinkageError: com/google/common/base/Optional
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
at
This was due to the fact that the two versions were loaded and were leading to the two errors.
Also I saw that quite lots of tools fixed the version 10.0.x (e.g. Acceleo, EMF Compare, MDT Papyrus, Atlassian JIRA connector for Mylyn).
So my question, which may be a bit naive, but I would be glad to share a point of view around this... For such bundles that deal with classloading & so on, would it be preferable to build them as singletons ? This would prevent, at least, the installation of later versions when a specific version is already installed...
Thanks a lot in advance !
Maxence Vanbésien
Worldline
mvaawl@gmail.com
|
|
|
Re: Make Google Guava bundles as singletons ? [message #1115476 is a reply to message #1102202] |
Tue, 24 September 2013 06:45 |
David Williams Messages: 722 Registered: July 2009 |
Senior Member |
|
|
On 09/05/2013 10:01 AM, Maxence Vanbesien wrote:
>
>
> So my question, which may be a bit naive, but I would be glad to share
> a point of view around this... For such bundles that deal with
> classloading & so on, would it be preferable to build them as
> singletons ? This would prevent, at least, the installation of later
> versions when a specific version is already installed...
>
>
Having as "singletons" only changes runtime behavior, not what gets
installed. And, at runtime, which ever one get's "ran first" would be
"the singleton" used for the rest of the session. This may or may not be
what's desired, and may or may not result in a "runtime error". It all
depends on who depends on what, and what function a user runs first.
That's why a) best not to have singletons :) and b) when unavoidable,
everyone needs to make sure they are using the same version, ideally.
There are other things that can be done to improve the situation (import
what you export) but not sure they'd work for bundles with "major"
changes. You don't say, but sounds like you are a "user/contributor",
not a committer? And Eclipse uses older version, but you'd like to use
newer version?
So, one thing you could do is open bugs on those projects and suggest
they upgrade to current version?
HTH
|
|
|
|
Powered by
FUDForum. Page generated in 0.03144 seconds