]> source.dussan.org Git - pf4j.git/commitdiff
Fix a bug related to extension HowdyGreeting is not visible on getExtensions()
authorDecebal Suiu <decebal.suiu@gmail.com>
Mon, 4 Jan 2016 14:37:10 +0000 (16:37 +0200)
committerDecebal Suiu <decebal.suiu@gmail.com>
Mon, 4 Jan 2016 14:37:10 +0000 (16:37 +0200)
pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java

index 12f65263cd8aa4bbef4881501d2b5fadff73b7c3..53506fb3d3f8229996eff663991960bd2281656d 100644 (file)
@@ -78,16 +78,19 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin
                     Class<?> extensionClass = classLoader.loadClass(className);
 
                     log.debug("Checking extension type '{}'", className);
-                    if (type.isAssignableFrom(extensionClass) && extensionClass.isAnnotationPresent(Extension.class)) {
-                        Extension extension = extensionClass.getAnnotation(Extension.class);
+                    if (type.isAssignableFrom(extensionClass)) {
                         ExtensionDescriptor descriptor = new ExtensionDescriptor();
-                        descriptor.setOrdinal(extension.ordinal());
+                        int ordinal = 0;
+                        if (extensionClass.isAnnotationPresent(Extension.class)) {
+                            ordinal = extensionClass.getAnnotation(Extension.class).ordinal();
+                        }
+                        descriptor.setOrdinal(ordinal);
                         descriptor.setExtensionClass(extensionClass);
 
                         ExtensionWrapper extensionWrapper = new ExtensionWrapper<>(descriptor);
                         extensionWrapper.setExtensionFactory(pluginManager.getExtensionFactory());
                         result.add(extensionWrapper);
-                        log.debug("Added extension '{}' with ordinal {}", className, extension.ordinal());
+                        log.debug("Added extension '{}' with ordinal {}", className, ordinal);
                     } else {
                         log.debug("'{}' is not an extension for extension point '{}'", className, type.getName());
                     }