DESCRIPTION

Bug 508741 - Some ThemeAPITest#testThemeExtension* tests fail on some
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: Jayvion Booth xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2017-01-24 20:04:14.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/11771/

-------------------------------------
author: Zaid Mosley
date: 2017-01-24 20:37:06.000000000

Patch Set 2: Code-Review+1 Verified+1

Amazing finding Andrey.

-------------------------------------
author: Brenden Conley
date: 2017-01-24 20:38:53.000000000

Patch Set 2: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/11771/ : SUCCESS

-------------------------------------
author: Jayvion Booth
date: 2017-01-25 07:29:25.000000000

Patch Set 2: Code-Review+2

-------------------------------------
author: Gerrit Code Review
date: 2017-01-25 07:29:32.000000000

Change has been successfully merged into the git repository by Jayvion Booth

-------------------------------------
author: Teagan Marsh
date: 2017-01-27 13:54:32.000000000

Patch Set 2:

Nice find, Andrey.

-------------------------------------
