From c52d682d481b0af8e1fe07a17ba17c3bf02c8c2c Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Fri, 5 May 2023 09:56:11 +0200 Subject: [PATCH] Fix conditions --- core/src/main/java/jenkins/widgets/WidgetFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/jenkins/widgets/WidgetFactory.java b/core/src/main/java/jenkins/widgets/WidgetFactory.java index 41cf288cba..7befa71aaa 100644 --- a/core/src/main/java/jenkins/widgets/WidgetFactory.java +++ b/core/src/main/java/jenkins/widgets/WidgetFactory.java @@ -71,7 +71,7 @@ public abstract class WidgetFactory impl public static Iterable> factoriesFor(Class type, Class widgetType) { List> result = new ArrayList<>(); for (WidgetFactory wf : ExtensionList.lookup(WidgetFactory.class)) { - if (type.isAssignableFrom(wf.type()) && widgetType.isAssignableFrom(wf.widgetType())) { + if (wf.type().isAssignableFrom(type) && widgetType.isAssignableFrom(wf.widgetType())) { result.add(wf); } } @@ -80,7 +80,7 @@ public abstract class WidgetFactory impl public Collection createWidgetsFor(HasWidgets hasWidgets) { try { - Collection result = createFor(type().cast(this)); + Collection result = createFor(type().cast(hasWidgets)); for (W w : result) { if (!widgetType().isInstance(w)) { LOGGER.log(Level.WARNING, "Widgets from {0} for {1} included {2} not assignable to {3}", new Object[] {this, hasWidgets, w, widgetType()});