Bug 576622: Do not sort adapter factories based on activation status

This resolves an issue where the adapter factory for class Y is used
instead of class X (see comment in AdapterManager).

This restores the order that was used prior to Bug 576024.

Change-Id: Id49fd936eaedc0ce99b13b1a426c394b32a4f9d6
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/186491
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
Reviewed-by: Christoph Laeubrich <laeubi@laeubi-soft.de>
Reviewed-by: Mickael Istria <mistria@redhat.com>
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java
index b75b223..90e39c9 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java
@@ -88,26 +88,6 @@
 
 	private static final AdapterManager singleton = new AdapterManager();
 
-	private static final Comparator<? super IAdapterFactory> ACTIVE_FIRST = new Comparator<IAdapterFactory>() {
-
-		@Override
-		public int compare(IAdapterFactory o1, IAdapterFactory o2) {
-			boolean factory1Loaded = isFactoryLoaded(o1);
-			boolean factory2Loaded = isFactoryLoaded(o2);
-			if (factory1Loaded == factory2Loaded) {
-				return 0;
-			}
-			if (factory1Loaded && !factory2Loaded) {
-				return -1;
-			}
-			if (!factory1Loaded && factory2Loaded) {
-				return +1;
-			}
-			return 0;
-		}
-
-	};
-
 	public static AdapterManager getDefault() {
 		return singleton;
 	}
@@ -358,7 +338,6 @@
 		Assert.isNotNull(adapterType);
 		return getFactories(adaptable.getClass()).getOrDefault(adapterType, Collections.emptyList()) //
 				.stream() //
-				.sorted(ACTIVE_FIRST) // prefer factories from already active bundles to minimize activation and return earlier when possible
 				.map(factory -> force && factory instanceof IAdapterFactoryExt ? ((IAdapterFactoryExt) factory).loadFactory(true) : factory) //
 				.filter(Objects::nonNull).map(factory -> {
 					Class<?> adapterClass = classForName(factory, adapterType);