[
https://issues.apache.org/jira/browse/SLING-9210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17061028#comment-17061028
]
Carsten Ziegeler commented on SLING-9210:
-----------------------------------------
While packageadmin is deprecated there is no need to move away from it - it
will always be there; the wiring spec is a little bit harder to use; but of
course if someone wants to do the change, there is nothing wrong with it.
I think picking the highest version is as wrong as picking the lowest; a
consistent classspace is the goal (which then also ensures a predictable
result).
The current architecture of dynamic classloading for scripts fails short of
this, as for example script a might need version 1.0 and script b might need
version 2.0 - but unless the script tells what it needs, there is no way to
guarantee the right answer.
So with the proposed solution you either have a deterministic wrong answer or a
deterministic right answer - but in case of a wrong answer, what do you do?
> Make DynamicClassloader behave deterministically in case several bundles
> export the same package
> ------------------------------------------------------------------------------------------------
>
> Key: SLING-9210
> URL: https://issues.apache.org/jira/browse/SLING-9210
> Project: Sling
> Issue Type: Improvement
> Affects Versions: Commons ClassLoader 1.4.4
> Reporter: Konrad Windszus
> Priority: Major
> Fix For: Commons ClassLoader 1.4.6
>
>
> Currently in case several bundles export the same package (in different
> versions) the first one is being picked in
> https://github.com/apache/sling-org-apache-sling-commons-classloader/blob/dedb69a9fb0f8cb2ebf3050560311739b9f00ce4/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java#L156,
> but it is not described which one is the first one in
> https://osgi.org/javadoc/r6/core/org/osgi/service/packageadmin/PackageAdmin.html#getExportedPackages(org.osgi.framework.Bundle).
> Given that now it is possible to install the same bundle in multiple version
> (SLING-9172 and FELIX-6232) a better, more predictable logic should be chosen.
> I propose to always pick the highest exported version.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)