Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

annotation processor creates wrong files under certain conditions #264

pinhead84 opened this issue Dec 27, 2018 · 2 comments

annotation processor creates wrong files under certain conditions #264

pinhead84 opened this issue Dec 27, 2018 · 2 comments


Copy link

I'm currently migrating my application from JPF to pf4j and discovered a problem in the ExtensionAnnotationProcessor in combination with the ServiceProviderExtensionStorage.

I'm using the following pattern to define extension points and extensions:


In contrast to your examples there are abstract classes (MainMenuAdapter, BootAdapter) for each available extension point. The extensions are derived from these abstract classes instead of the extension point interfaces (MainMenuExtensionPoint, BootExtensionPoint). This gives a bit more flexibility, because later added methods in an extension point can be implemented in the abstract classes without the need of modifying the extension points in all plugins. From my experience in certain projects this is a quite common pattern - similar to the java.awt.event.WindowListener / java.awt.event.WindowAdapter approach in the Java classpath.

Basically this approach also works with pf4j. But the ExtensionAnnotationProcessor in combination with the ServiceProviderExtensionStorage doesn't behave as expected in this scenario. For the above scenario the following files are generated:


Instead the ExtensionAnnotationProcessor should create these files:


Because of this problem the PluginManager is not able to load the extensions by its interface via pluginManager.getExtensions(BootExtensionPoint.class). Instead I would have to call pluginManager.getExtensions(BootAdapter.class).

I'm going to propose a pull request with a possible workaround for this problem.

pinhead84 added a commit to pinhead84/pf4j that referenced this issue Dec 27, 2018
This is a workaround for issue pf4j#264. An extension may provide its implemented extension points explicitly through its annotation. In this case the annotation processor does not try to detect the extension points for an extension automatically (which fails under certain conditions).
Copy link

Thanks again for detailed explanation. Now, the case with adapters doesn't work. The adapters are see as extensions by PF4J.
Your approach proposed in #265 is good. The same approach I use in Pippo to declare extensions.
So, after some reviews and comments, #265 will be merged and the issue will be resolved.

Copy link
Contributor Author

Thanks for merging my pull request. I will close this issue accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants