mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-03 15:15:54 +00:00
Made the order of components bit more deterministic
This commit is contained in:
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user