Skip to content

I20170126-0505

@iloveeclipse iloveeclipse tagged this 24 Jan 20:04
platforms

TopologicalSort didn't preserved definition order for the extensions
with same id from same plugin.xml, because it used a custom, *random*
order of iteration offered by HashMap. Quote: "This class makes no
guarantees as to the order of the map; in particular, it does not
guarantee that the order will remain constant over time."

Depending on the order of map insertion and on the custom HashMap hash
algorithm implementation, the TopologicalSort produced different results
for same inputs on different environments, so that equal elements order
was changed by the sort algorithm and the result order for equal
elements was more or less random in different environments. This showed
up in the unstable test behavior of the ThemeAPITest, which relied on
the right (definition) order of contributions to the
"org.eclipse.ui.themes" extension point.

By using "Linked" versions of the Map and Set we make the code in
TopologicalSort stable across different environments because we preserve
the sort order for equal elements and so preserve the definition order
for contributions with equal keys coming from same plugin.xml.

See also
http://javaclipse.blogspot.de/2016/03/stable-tests-and-transition-to-java-8.html

Change-Id: Iabba91de64a8bb96da4589ff74cda0506e4fd886
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Assets 2
Loading