[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [equinox-dev] result of VersionHashMap.compare() depends on sort algorithm?
- From: Thomas Watson <tjwatson@xxxxxxxxxx>
- Date: Wed, 10 Jul 2013 08:21:52 -0500
- Delivered-to: email@example.com
It sounds like there is a possible bug in Equinox if we get different sort results depending on the version of the VM. But I am confused why the class GenericSpecificationImpl is involved when dealing with multiple providers of a package. The old equinox resolver is strongly typed for the specific OSGi dependency 'types'. For example, with packages I would have expected ImportPackageSpecificationImpl  to be used which can only have a single provider.
 - http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java?h=R3_9_maintenance
"Sievers, Jan" ---07/10/2013 03:34:46 AM---Hi, in the course of tycho bug
From: "Sievers, Jan" <jan.sievers@xxxxxxx>
To: "equinox-dev@xxxxxxxxxxx" <equinox-dev@xxxxxxxxxxx>,
Date: 07/10/2013 03:34 AM
Subject: [equinox-dev] result of VersionHashMap.compare() depends on sort algorithm?
Sent by: equinox-dev-bounces@xxxxxxxxxxx
in the course of tycho bug
we found that that the result of sorting resolverExports in ResolverImpl  depends on the JDK Collections.sort() algorithm implementation.
It seems that for two VersionSuppliers which are equal according to all comparison attributes, the (arbitrary) order of vs1 and vs2 in compare(V vs1, V vs2) decides which one wins .
This would not matter as long as the two VersionSuppliers are really equal.
However if you are interested in whether the package is a system export , the directive equinox-ee matters.
Now if you have several suppliers of the same package (system-exported and not system-exported), the result of StateHelperImpl.isSystemExport() effectively depends on the JDK sort algorithm. (This is because GenericSpecificationImpl.getSupplier()  takes the first package in the (sorted) list if several are present)
Is the sort result depending on the JDK sort algorithm implementation in this case a bug or intended behaviour?
For the tycho bug, I have a tentative patch ; Can you comment if this is the correct way to fix it?
equinox-dev mailing list