diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2016-01-04 16:37:10 +0200 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2016-01-04 16:37:10 +0200 |
commit | 07392518f802da10fbf67bf02eaad4e76da4367c (patch) | |
tree | 0d923003284f125704ea98cbfce1e0fffcaf9366 /pf4j | |
parent | ce73b9b61e21c5dfb2a5fe36bff2a8173141814c (diff) | |
download | pf4j-07392518f802da10fbf67bf02eaad4e76da4367c.tar.gz pf4j-07392518f802da10fbf67bf02eaad4e76da4367c.zip |
Fix a bug related to extension HowdyGreeting is not visible on getExtensions()
Diffstat (limited to 'pf4j')
-rw-r--r-- | pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java index 12f6526..53506fb 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java @@ -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()); } |