diff --git a/core/src/main/java/hudson/tasks/Publisher.java b/core/src/main/java/hudson/tasks/Publisher.java index 1b798e5b3813..e486dc8c541a 100644 --- a/core/src/main/java/hudson/tasks/Publisher.java +++ b/core/src/main/java/hudson/tasks/Publisher.java @@ -130,10 +130,7 @@ public Descriptor getDescriptor() { * * @see DescriptorExtensionList#createDescriptorList(hudson.model.Hudson, Class) */ - @SuppressFBWarnings(value = "SE_COMPARATOR_SHOULD_BE_SERIALIZABLE", justification = "Since the publisher is not Serializable, " + - "no need for the Comparator") - public static final class DescriptorExtensionListImpl extends DescriptorExtensionList> - implements Comparator>> { + public static final class DescriptorExtensionListImpl extends DescriptorExtensionList> { public DescriptorExtensionListImpl(Jenkins hudson) { super(hudson, Publisher.class); @@ -142,10 +139,14 @@ public DescriptorExtensionListImpl(Jenkins hudson) { @Override protected List>> sort(List>> r) { List>> copy = new ArrayList<>(r); - copy.sort(this); + copy.sort(new ExtensionComponentComparator()); return copy; } + } + @SuppressFBWarnings(value = "SE_COMPARATOR_SHOULD_BE_SERIALIZABLE", justification = "Since the publisher is not Serializable, " + + "no need for the Comparator") + private static final class ExtensionComponentComparator implements Comparator>> { @Override public int compare(ExtensionComponent> lhs, ExtensionComponent> rhs) { int r = classify(lhs.getInstance()) - classify(rhs.getInstance());