So far so good..
what i meant more precisely is that "util" is the implementation of the
stable part of the API.. and it has methods that take the API's object
as parameters..

let's say:
servlet API v1:
com.servlet.Request
com.servlet.Servlet
   => public void doRequest(Request)
com.servlet.Context
   => public void setServlet(Servlet)

servlet API v11:
com.servlet.Request
com.servlet.Servlet
   => public void doRequest(Request, String param)
com.servlet.Context
   => public void setServlet(Servlet)

impl v1:
util.RequestImpl implements Request (v1)
util.ContextImpl implements Context (v1)
implem1.ServletImpl implements Servlet (v1)

impl v11:
implem11.ServletImpl implements Servlet (v11)

Most of the API (here Request and Context) has not changed and neither
has the implementation. But then at runtime, implv11 will pass a v11
version of Servlet to the setServlet() method of Context...

(Am i making any sense or am i just confused?!)
Honestly, the question arose as a theoretical one and we're not blocked
in a real life issue for now.
Now after discussion with a colleague, his opinion is that it's simply a
packaging issue to duplicate the util class files (for RequestImpl and
ContextImpl) in both implementation bundles without duplicating the
actual source code... and i tend to agree with him, as I do not see an
option to totally avoid duplication.
What do you think?


/Arjun



Richard S. Hall wrote:
I don't see any issues here. Just make sure you have your import ranges properly scoped for the packages you need.

For example:

APIv1: export api;version=1.0
APIv11: export api;version=1.1
IMPLv1: export util;version=1.0, import api;version[1.0,1.0]
IMPLv11: import api;version=[1.1,1.1],util;version=[1.0,1.0]
CLIENTv1: import api;version=[1.0,1.0]
CLIENTv11: import api;version=[1.1,1.1]

-> richard

Arjun Panday wrote:
Imagine we have, in the same JVM :
- API 1.0
- API 1.1
- an implementation bundle for the 1.0 version of the API
- an implementation bundle for the 1.1 version of the API
- a client imports API;version="1.0"
- a client imports API;version="1.1"

API 1.1 is NOT backward compatible with 1.0 (same classes but differences in methods signatures) In spite of the differences, both implementations share the same code base (based on v1.0); that is, implementation 1.1 extends (imports) common code from implementation 1.0 (we could move the common code to a separate bundle, but the problem remains)

The question is how do we avoid linkage errors? (and avoid duplicating the common code!) : the common code and 1.0 implementation are wired to API 1.0, but the 1.1 implementation will be wired to the 1.1 API AND to the 1.0 API (for the common code)

Any suggestion?

Thanks,
/Arjun

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to