From a866af82241692825139e57508a93366e0ca85a6 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Mon, 21 Mar 2016 21:32:38 +0200 Subject: [PATCH] Try to create a defense for the issues similar with #97 --- .../java/ro/fortsoft/pf4j/AbstractExtensionFinder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java index 3cefea9..efa025b 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java @@ -44,6 +44,7 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin public abstract Map> readClasspathStorages(); @Override + @SuppressWarnings("unchecked") public List> find(Class type) { log.debug("Finding extensions for extension point '{}'", type.getName()); Map> entries = getEntries(); @@ -85,7 +86,12 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin result.add(extensionWrapper); log.debug("Added extension '{}' with ordinal {}", className, ordinal); } else { - log.debug("'{}' is not an extension for extension point '{}'", className, type.getName()); + log.warn("'{}' is not an extension for extension point '{}'", className, type.getName()); + ClassLoader classLoader1 = type.getClassLoader(); + ClassLoader classLoader2 = extensionClass.getClassLoader(); + if (!classLoader1.equals(classLoader2)) { + log.warn("Different class loaders: '{}' and '{}'", classLoader1, classLoader2); + } } } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); -- 2.39.5