From 07392518f802da10fbf67bf02eaad4e76da4367c Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Mon, 4 Jan 2016 16:37:10 +0200 Subject: [PATCH] Fix a bug related to extension HowdyGreeting is not visible on getExtensions() --- .../ro/fortsoft/pf4j/AbstractExtensionFinder.java | 11 +++++++---- 1 file 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()); } -- 2.39.5