Skip to content

Commit

Permalink
Fix compilation error with maven.compiler.release=21 (#8520)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Sep 24, 2023
1 parent d714d31 commit 3f1c555
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/src/main/java/hudson/tasks/Publisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ public Descriptor<Publisher> 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<Publisher, Descriptor<Publisher>>
implements Comparator<ExtensionComponent<Descriptor<Publisher>>> {
public static final class DescriptorExtensionListImpl extends DescriptorExtensionList<Publisher, Descriptor<Publisher>> {

public DescriptorExtensionListImpl(Jenkins hudson) {
super(hudson, Publisher.class);
Expand All @@ -142,10 +139,14 @@ public DescriptorExtensionListImpl(Jenkins hudson) {
@Override
protected List<ExtensionComponent<Descriptor<Publisher>>> sort(List<ExtensionComponent<Descriptor<Publisher>>> r) {
List<ExtensionComponent<Descriptor<Publisher>>> 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<ExtensionComponent<Descriptor<Publisher>>> {
@Override
public int compare(ExtensionComponent<Descriptor<Publisher>> lhs, ExtensionComponent<Descriptor<Publisher>> rhs) {
int r = classify(lhs.getInstance()) - classify(rhs.getInstance());
Expand Down

0 comments on commit 3f1c555

Please sign in to comment.