same package in two different bundles: a problem? [message #331517] |
Thu, 11 September 2008 03:26  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #331544 is a reply to message #331528] |
Thu, 11 September 2008 16:37   |
Eclipse User |
|
|
|
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 #331550 is a reply to message #331530] |
Thu, 11 September 2008 16:54   |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.04025 seconds