Made the order of components bit more deterministic

This commit is contained in:
Kohsuke Kawaguchi committed 2011-05-02 18:11:08 +02:00
1 parent cc90b7fe1d
commit fe452bfbc5
2 files changed
+11 -1

No files matched your search

@@ -24,6 +24,8 @@
package hudson;
import hudson.model.Descriptor;
/**
* Discovered {@link Extension} object with a bit of metadata for Hudson.
* This is a plain value object.
@@ -72,6 +74,12 @@ public class ExtensionComponent<T> implements Comparable<ExtensionComponent<T>>
double b = that.ordinal();
if (a>b) return -1;
if (a<b) return 1;
return 0;
// make the order bit more deterministic among extensions of the same ordinal
if (this.instance instanceof Descriptor) {
return ((Descriptor)this.instance).getDisplayName().compareTo(((Descriptor)that.instance).getDisplayName());
} else {
return this.instance.getClass().getName().compareTo(that.instance.getClass().getName());
}
}
}