Tom Watson created FELIX-6525:
---------------------------------

             Summary: org.apache.felix.http.servlet-api exports multiple 
versions with no uses
                 Key: FELIX-6525
                 URL: https://issues.apache.org/jira/browse/FELIX-6525
             Project: Felix
          Issue Type: Improvement
          Components: HTTP Service
    Affects Versions: http.servlet-api-1.2.0
            Reporter: Tom Watson


Here is the Export-Package for the bundle
{quote}
Export-Package: 
  
javax.servlet;version="2.6";uses:="javax.servlet.annotation,javax.servlet.descriptor",
  
javax.servlet.annotation;version="2.6";uses:="javax.servlet",javax.servlet.descriptor;version="2.6",
  javax.servlet.http;version="2.6";uses:="javax.servlet",
  javax.servlet;version="3.0",
  javax.servlet.annotation;version="3.0",
  javax.servlet.descriptor;version="3.0",
  javax.servlet.http;version="3.0",
  javax.servlet;version="3.1",
  javax.servlet.annotation;version="3.1",
  javax.servlet.descriptor;version="3.1",
  javax.servlet.http;version="3.1",
  javax.servlet;version="4.0",
  javax.servlet.annotation;version="4.0",
  javax.servlet.descriptor;version="4.0",
  javax.servlet.http;version="4.0"{quote}

Only the lowest version of the packages is exported with the `uses` directive.  
I believe this will cause some very difficult to debug resolution issues.  Each 
export becomes a distinct capability to the resolver.  Bundles wiring to the 
2.6 versions will be constrained by the used packages while bundles that can 
wiring to the higher versions will not be constrained.

This becomes even more prevalent if a bundle uses the recommended way to 
consume these osgi.contract bundles.  There they would import the packages 
without any specified version, but then also put a requirement on the 
osgi.contract for JavaServlet at a specific version.  This contract is also 
provided by this servlet-api bundle with the proper uses constraints.  But now 
that leaves the resolver with the option to choose any versions exported by 
this bundle.  Most likely the framework ResolveContext is going to start with 
the highest version available.  And that package will have no uses contraints.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to