Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » same package in two different bundles: a problem?
same package in two different bundles: a problem? [message #331517] Thu, 11 September 2008 03:26 Go to next message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
WinXP & R3.3

We have two different bundles (plug-ins) that happen both to declare a
package, say "com.mun.ist.foo", but contain no conflicting classes
(i.e., if there is a class named Bar in that package it appears in only
one of the bundles). The code all compiles and runs fine.

I think this is not a problem, as (e.g.) Eclipse does the same:

a) package org.eclipse.ui.internal:
(BUNDLE) org.eclipse.ui => (PACKAGE) org.eclipse.ui.internal

(BUNDLE) org.eclipse.ui.workbench => (PACKAGE) org.eclipse.ui.internal

b) package org.eclipse.core.runtime:
(BUNDLE) org.eclipse.core.runtime => (PACKAGE) org.eclipse.core.runtime

(BUNDLE) org.eclipse.osgi => (PACKAGE) org.eclipse.core.runtime

(BUNDLE) org.eclipse.equinox.common => (PACKAGE) org.eclipse.core.runtime

(BUNDLE) org.eclipse.core.runtime.compatibility.registry => (PACKAGE)
org.eclipse.core.runtime

(BUNDLE) org.eclipse.equinox.registry => (PACKAGE) org.eclipse.core.runtime

================

But someone is now trying to claim that the mere presence of the same
package in two bundles will cause the class-loader to fail. (He offers
no actual evidence.)

What's the story?

thanks,
Paul
Re: same package in two different bundles: a problem? [message #331528 is a reply to message #331517] Thu, 11 September 2008 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Paul Th. Keyser wrote:
> WinXP & R3.3
>
> We have two different bundles (plug-ins) that happen both to declare a
> package, say "com.mun.ist.foo", but contain no conflicting classes
> (i.e., if there is a class named Bar in that package it appears in only
> one of the bundles). The code all compiles and runs fine.
>
> I think this is not a problem, as (e.g.) Eclipse does the same:
>
> But someone is now trying to claim that the mere presence of the same
> package in two bundles will cause the class-loader to fail. (He offers
> no actual evidence.)

First thing I'd say is, "show me the money!" In other words, produce a
demonstration or documentation that says it fails. Without that, there
is no discussion.
Secondly, you have already pointed out that Eclipse "core" plugins do
this all over he place without any problems. That is pretty strong
evidence to the contrary.
Finally, remind this someone that plugins use a special custom
classloader, so his understanding of the standard classloader may not
apply here. OSGi is specialized when it comes to class loading.

Hope this helps,
Eric
Re: same package in two different bundles: a problem? [message #331530 is a reply to message #331517] Thu, 11 September 2008 13:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zx.code9.com

Paul Th. Keyser wrote:
> But someone is now trying to claim that the mere presence of the same
> package in two bundles will cause the class-loader to fail. (He offers
> no actual evidence.)
>
> What's the story?

As long as things are done properly, you should have no problem. I wrote
about some of this a few weeks ago:

http://code9.com/2008/08/22/tip-split-packages-and-visibilit y/

Cheers,

~ Chris
Re: same package in two different bundles: a problem? [message #331544 is a reply to message #331528] Thu, 11 September 2008 16:37 Go to previous messageGo to next message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> Paul Th. Keyser wrote:
>> WinXP & R3.3
>>
>> We have two different bundles (plug-ins) that happen both to declare a
> Hope this helps,
> Eric

:) Beautiful, thanks. (I also, subsequently, happened to notice also
that the jar that used to contain this code had/has exactly the same
packaging, so the test had in effect already been done.)

-Paul
Re: same package in two different bundles: a problem? [message #331546 is a reply to message #331530] Thu, 11 September 2008 16:40 Go to previous messageGo to next message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
Chris Aniszczyk wrote:
> Paul Th. Keyser wrote:
> http://code9.com/2008/08/22/tip-split-packages-and-visibilit y/
>
> Cheers,
>
> ~ Chris

Thanks, very nice -- and that OSGi course (also mentioned on Code-9)
sounds interesting ...

-Paul
Re: same package in two different bundles: a problem? [message #331550 is a reply to message #331530] Thu, 11 September 2008 16:54 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Chris Aniszczyk wrote:
> Paul Th. Keyser wrote:
>> But someone is now trying to claim that the mere presence of the same
>> package in two bundles will cause the class-loader to fail. (He
>> offers no actual evidence.)
>>
>> What's the story?
>
> As long as things are done properly, you should have no problem.
Well "properly" is the key here ;-)
Important is to not access package visible stuff (types, methods, etc.)
from the other plug-in's package as this would result in an
IllegalAccessError thrown by the class loader.

Dani
> I wrote about some of this a few weeks ago:
>
> http://code9.com/2008/08/22/tip-split-packages-and-visibilit y/
>
> Cheers,
>
> ~ Chris
Re: same package in two different bundles: a problem? [message #331559 is a reply to message #331546] Thu, 11 September 2008 18:10 Go to previous message
Eclipse UserFriend
Originally posted by: zx.code9.com

Paul Th. Keyser wrote:
> Chris Aniszczyk wrote:
>> Paul Th. Keyser wrote:
>> http://code9.com/2008/08/22/tip-split-packages-and-visibilit y/
>>
>> Cheers,
>>
>> ~ Chris
>
> Thanks, very nice -- and that OSGi course (also mentioned on Code-9)
> sounds interesting ...

Cool! I'll shoot you an email with more information.

Cheers,

~ Chris
Previous Topic:Creating a perspective on Runtime
Next Topic:Obtaining *all* referenced projects (including plugins and external folders)
Goto Forum:
  


Current Time: Thu Dec 26 16:46:41 GMT 2024

Powered by FUDForum. Page generated in 0.04539 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top