OSGI / PDE /equinox dependency leak for imported packages with classes with base classes in other bundles

View: New views
3 Messages — Rating Filter:   Alert me  

OSGI / PDE /equinox dependency leak for imported packages with classes with base classes in other bundles

by erwin dl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear,

I have the following situation which should occur in many OSGi applications :

- bundle b.A implements/delivers some library containing a base class with full name b.A.BaseClass
-- this BaseClass implements some public methods
- bundle b.B implements/delivers a concrete implementation with a class b.B.SubClass that inherits from b.A.BaseClass
- bundle b.C needs to use b.B.SubClass

In such a case, I would assume that bundle b.C only needs to express a dependency (import package) on bundle b.B, and the fact that b.B.SubClass inherits from a BaseClass should be an implementation detail, transparent for b.C.

But, unfortunately, once I want to use a method on b.B.SubClass, which is inherited from the BaseClass, PDE forces me to also include a dependency on b.A in b.C.

And so there is a dependency leakage...

Is this caused by a fundamental OSGi construct/decision/..., or specific for PDE?

kind regards
erwin

_______________________________________________
equinox-dev mailing list
equinox-dev@...
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Re: OSGI / PDE /equinox dependency leak for imported packages with classes with base classes in other bundles

by Jeff McAffer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is required for the compiler.  At compile time you need to see  
the complete supertype hierarchy of the type being compiled.  At  
runtime this is not required.  Basically this is caused by the JDT  
compiler using a flattened classpath rather than a delegating  
structure that matches the OSGi runtime.

To get around this, add the the bundle declaring the super type (b.A  
in this case) to the Automated Management of Dependencies section on  
the Dependencies page of b.C's manifest editor. this puts it on the  
compile time classpath of b.C but does not add it to b.C's manifest.

Voila

Jeff


On 17-Sep-09, at 5:00 AM, erwin dl wrote:

> Dear,
>
> I have the following situation which should occur in many OSGi  
> applications :
>
> - bundle b.A implements/delivers some library containing a base  
> class with full name b.A.BaseClass
> -- this BaseClass implements some public methods
> - bundle b.B implements/delivers a concrete implementation with a  
> class b.B.SubClass that inherits from b.A.BaseClass
> - bundle b.C needs to use b.B.SubClass
>
> In such a case, I would assume that bundle b.C only needs to express  
> a dependency (import package) on bundle b.B, and the fact that  
> b.B.SubClass inherits from a BaseClass should be an implementation  
> detail, transparent for b.C.
>
> But, unfortunately, once I want to use a method on b.B.SubClass,  
> which is inherited from the BaseClass, PDE forces me to also include  
> a dependency on b.A in b.C.
>
> And so there is a dependency leakage...
>
> Is this caused by a fundamental OSGi construct/decision/..., or  
> specific for PDE?
>
> kind regards
> erwin
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@...
> https://dev.eclipse.org/mailman/listinfo/equinox-dev

_______________________________________________
equinox-dev mailing list
equinox-dev@...
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Re: OSGI / PDE /equinox dependency leak for imported packages with classes with base classes in other bundles

by erwin dl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the clear and useful answer!

cheers
erwin

On Sat, Sep 19, 2009 at 4:59 PM, Jeff McAffer <jeff@...> wrote:
This is required for the compiler.  At compile time you need to see the complete supertype hierarchy of the type being compiled.  At runtime this is not required.  Basically this is caused by the JDT compiler using a flattened classpath rather than a delegating structure that matches the OSGi runtime.

To get around this, add the the bundle declaring the super type (b.A in this case) to the Automated Management of Dependencies section on the Dependencies page of b.C's manifest editor. this puts it on the compile time classpath of b.C but does not add it to b.C's manifest.

Voila

Jeff



On 17-Sep-09, at 5:00 AM, erwin dl wrote:

Dear,

I have the following situation which should occur in many OSGi applications :

- bundle b.A implements/delivers some library containing a base class with full name b.A.BaseClass
-- this BaseClass implements some public methods
- bundle b.B implements/delivers a concrete implementation with a class b.B.SubClass that inherits from b.A.BaseClass
- bundle b.C needs to use b.B.SubClass

In such a case, I would assume that bundle b.C only needs to express a dependency (import package) on bundle b.B, and the fact that b.B.SubClass inherits from a BaseClass should be an implementation detail, transparent for b.C.

But, unfortunately, once I want to use a method on b.B.SubClass, which is inherited from the BaseClass, PDE forces me to also include a dependency on b.A in b.C.

And so there is a dependency leakage...

Is this caused by a fundamental OSGi construct/decision/..., or specific for PDE?

kind regards
erwin
_______________________________________________
equinox-dev mailing list
equinox-dev@...
https://dev.eclipse.org/mailman/listinfo/equinox-dev

_______________________________________________
equinox-dev mailing list
equinox-dev@...
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@...
https://dev.eclipse.org/mailman/listinfo/equinox-dev