]> source.dussan.org Git - pf4j.git/commitdiff
Try to create a defense for the issues similar with #97
authorDecebal Suiu <decebal.suiu@gmail.com>
Mon, 21 Mar 2016 19:32:38 +0000 (21:32 +0200)
committerDecebal Suiu <decebal.suiu@gmail.com>
Mon, 21 Mar 2016 19:32:38 +0000 (21:32 +0200)
pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java

index 3cefea9c61ef1c3a639c4ff503d1e2450699717a..efa025bf85fc39ae1c0cd0ec5af96bbce23e13fb 100644 (file)
@@ -44,6 +44,7 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin
     public abstract Map<String, Set<String>> readClasspathStorages();
 
     @Override
+    @SuppressWarnings("unchecked")
        public <T> List<ExtensionWrapper<T>> find(Class<T> type) {
                log.debug("Finding extensions for extension point '{}'", type.getName());
         Map<String, Set<String>> 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);