Hi,

in the course of tycho bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=407395#c8

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?

Thanks,
Jan

[1] 
http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java?h=R3_9_maintenance#n71
 
[2] 
http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java?h=R3_9_maintenance#n107
 
[3] 
http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java?h=R3_9_maintenance#n487
 
[4] 
http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java?h=R3_9_maintenance#n111
 
[5] https://git.eclipse.org/r/#/c/14372/ 
_______________________________________________
equinox-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to