Bug 478465 - Uses constraint violation (package expose via two dependency chains) related to javax.annotation in Luna and Mars SDKs
Summary: Uses constraint violation (package expose via two dependency chains) related ...
Status: CLOSED WORKSFORME
Alias: None
Product: Community
Classification: Eclipse Foundation
Component: Cross-Project (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Cross-Project issues CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 478461 465682 476044
  Show dependency tree
 
Reported: 2015-09-26 05:52 EDT by Alexander Nyßen CLA
Modified: 2020-01-29 07:42 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nyßen CLA 2015-09-26 05:52:49 EDT
Some of our GEF4 bundles (org.eclipse.gef4.fx, org.eclipse.gef4.mvc, org.eclipse.gef4.mvc.fx, and org.eclipse.zest.fx) provide a bundle dependency on org.eclipse.osgi;bundle-version="[3.9.0,4.0.0)", as well as package imports for some Google Guava packages in the form of: 

Import-Package: com.google.common.collect;version="[12.0.0,16.0.0)",
                com.google.common.reflect;version="[12.0.0,16.0.0)",
                ...

In certain situations this leads to 'Uses constraint violations' (related to two dependency chains on 'javax.annotation', via org.eclipse.osgi as well as com.google.reflect) like the following:

!ENTRY org.eclipse.gef4.dot.ui 4 0 2015-04-28 12:41:47.530
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.gef4.dot.ui [280]
  Unresolved requirement: Require-Bundle: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0"
    -> Bundle-SymbolicName: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0.201504280601"
       org.eclipse.gef4.mvc.fx [297]
         No resolution report for the bundle.  Unresolved requirement: Require-Bundle: org.eclipse.gef4.zest.fx; bundle-version="0.1.0"
    -> Bundle-SymbolicName: org.eclipse.gef4.zest.fx; bundle-version="0.1.0.201504280601"
       org.eclipse.gef4.zest.fx [304]
         Unresolved requirement: Require-Bundle: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0"
           -> Bundle-SymbolicName: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0.201504280601"
  Unresolved requirement: Require-Bundle: org.eclipse.gef4.zest.fx.ui; bundle-version="0.1.0"
    -> Bundle-SymbolicName: org.eclipse.gef4.zest.fx.ui; bundle-version="0.1.0.201504280601"; singleton:="true"
       org.eclipse.gef4.zest.fx.ui [305]
         Unresolved requirement: Require-Bundle: org.eclipse.gef4.zest.fx; bundle-version="0.1.0"
           -> Bundle-SymbolicName: org.eclipse.gef4.zest.fx; bundle-version="0.1.0.201504280601"
         Unresolved requirement: Require-Bundle: org.eclipse.gef4.mvc.fx.ui; bundle-version="0.1.0"
           -> Bundle-SymbolicName: org.eclipse.gef4.mvc.fx.ui; bundle-version="0.1.0.201504280601"
              org.eclipse.gef4.mvc.fx.ui [298]
                Unresolved requirement: Require-Bundle: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0"
                  -> Bundle-SymbolicName: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0.201504280601"
         Unresolved requirement: Require-Bundle: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0"
           -> Bundle-SymbolicName: org.eclipse.gef4.mvc.fx; bundle-version="0.1.0.201504280601"
  Unresolved requirement: Require-Bundle: org.eclipse.gef4.mvc.fx.ui; bundle-version="0.1.0"
    -> Bundle-SymbolicName: org.eclipse.gef4.mvc.fx.ui; bundle-version="0.1.0.201504280601"
  Bundle was not resolved because of a uses contraint violation.
  org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource org.eclipse.gef4.mvc.fx [osgi.identity; osgi.identity="org.eclipse.gef4.mvc.fx"; type="osgi.bundle"; version:Version="0.1.0.201504280601"] because it is exposed to package 'javax.annotation' from resources org.eclipse.osgi [osgi.identity; osgi.identity="org.eclipse.osgi"; type="osgi.bundle"; version:Version="3.10.2.v20150203-1939"; singleton:="true"] and javax.annotation [osgi.identity; osgi.identity="javax.annotation"; type="osgi.bundle"; version:Version="1.2.0.v201401042248"] via two dependency chains.

Chain 1:
  org.eclipse.gef4.mvc.fx [osgi.identity; osgi.identity="org.eclipse.gef4.mvc.fx"; type="osgi.bundle"; version:Version="0.1.0.201504280601"]
    require: (&(osgi.wiring.bundle=org.eclipse.osgi)(&(bundle-version>=3.10.0)(!(bundle-version>=4.0.0))))
     |
    provide: osgi.wiring.bundle: [org.eclipse.osgi, system.bundle]
  org.eclipse.osgi [osgi.identity; osgi.identity="org.eclipse.osgi"; type="osgi.bundle"; version:Version="3.10.2.v20150203-1939"; singleton:="true"]

Chain 2:
  org.eclipse.gef4.mvc.fx [osgi.identity; osgi.identity="org.eclipse.gef4.mvc.fx"; type="osgi.bundle"; version:Version="0.1.0.201504280601"]
    import: (&(osgi.wiring.package=com.google.common.reflect)(&(version>=12.0.0)(!(version>=16.0.0))))
     |
    export: osgi.wiring.package=com.google.common.reflect; uses:=javax.annotation
  com.google.guava [osgi.identity; osgi.identity="com.google.guava"; type="osgi.bundle"; version:Version="15.0.0.v201403281430"]
    import: (osgi.wiring.package=javax.annotation)
     |
    export: osgi.wiring.package: javax.annotation
  javax.annotation [osgi.identity; osgi.identity="javax.annotation"; type="osgi.bundle"; version:Version="1.2.0.v201401042248"]
	at org.eclipse.osgi.container.Module.start(Module.java:434)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

I had faced such a problem first in the context of the Luna SDK (see bug #465682). I could figure out that the problem can be fixed when I add an unconstrained (i.e. no version range specified) package import for javax.annotation to the respective GEF4 bundles. Because I could not reproduce this with the Mars IDE for committers (and thought it to be a fixed underlying problem), I created some GEF4 'Luna Compatibility' fragments that contribute a respective unconstrained java.annotation package import to the GEF4 host bundles.

However, we recently ran into the same problems in the context of Mars and Mars.1 SDK (see bug #476044 and #478461). Interestingly, these are not reproducible in the Mars IDE for committers or the Mars IDE for Java developers, but only in the SDK (see bug #476044). I assume this is because there is a bundle present that resolves the dependency on javax.annotation already (similar to what our fragments do).

I had run into similar problems when investigating whether the 'uses' directive should be used for package imports (see discussion in bug #437107) and thus fear there is some fundamental underlying problem that might be 'cross-project'.
Comment 1 Eclipse Genie CLA 2017-09-16 13:36:48 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Eclipse Genie CLA 2019-09-08 12:11:12 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Frederic Gurr CLA 2020-01-29 07:42:09 EST
A lot has changed in the last 5 years, therefore closing. Please re-open if this issue is still relevant.