[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] result of VersionHashMap.compare() depends on sort algorithm?

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 [1] to be used which can only have a single provider.


[1] - 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

Inactive hide details for "Sievers, Jan" ---07/10/2013 03:34:46 AM---Hi, in the course of tycho bug"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 [1] 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 [2].

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 [3], 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() [4] 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 [5]; Can you comment if this is the correct way to fix it?


equinox-dev mailing list

GIF image