-
-
Notifications
You must be signed in to change notification settings - Fork 548
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
Support any interface as an ExtensionPoint #289
Comments
As far as I understand, the Have you already tested to add an extension without this annotation to Edit: Sorry, I guess, that I understood your question wrong. I guess my answer points to the wrong direction... |
The idea with the interface marker
On the other hand, if you insist to use any interface or abstract class as an extension point, without to extends the marker interface |
Thanks for the responses, I see, extending the Regarding the control over available extensions: isn't it true that the application already controls which extensions a plugin can provide by explicitly invoking An automatic documentation (something like I think it would also be nice if this feature, if implemented, requires as little configuration as possible and is easy to use. |
@dmitry-timofeev |
Hi, @decebals, I tried it, and bumped into a limitation that indirectly implemented interfaces (e.g., through a super class) cannot be used as an extension point. Would it make sense to allow explicit specification to support this case? Currently it is not possible because Extension#points accepts only classes implementing /* Doesn’t work unless HashFunction < ExtensionPoint */
@Extension(points = HashFunction.class)
public final class MyHashFunction extends AbstractHashFunction {
…
} That would also allow multiple interfaces (whether directly implemented by a class, or indirectly): @Extension(points = {Foo.class, Bar.class})
public final class MyFooBar implements Foo, Bar {
…
} Also, would it be reasonable to just register an extension for all directly implemented classes; and require the explicitly specified points when some are indirectly present (through superclasses or superinterfaces)? |
Is the compiler argument a temporary switch, or will it remain required? |
If I relax a little bit the type for But for the moment, I will consider this case (with some values for
Yes. I think so. But in my projects I didn't encounter situations that require a feature described by you in this issue. Maybe you can answer to this question. Is it enough for you the current implementation that already exists on master (without support for |
I opt for the current version (compiler argument). The idea is to not add extra work/check in processor. Sure, if other people have other opinions we can change this behavior. |
I also don't see the immediate need for registering an Extension for multiple directly present interfaces automatically. There are no such scenarious in our project. Regarding the indirectly present interfaces (either a single one or multiple), I think it would be useful. I agree that the place of |
@dmitry-timofeev |
I think it is good, thank you very much! |
This feature is included in the latest release (3.2.0). |
The #360 comes to improve the support for any interface/class as an extension point. |
Currently a plugin cannot provide an extension implementing an interface that does not extend
ExtensionPoint
. That prevents the applications from using the interfaces they do not control as extension points (e.g., from the standard library or from any third-party library).For example, if one needs to provide an implementation of
HashFunction
interface from Guava, they could writeA similar functionality is allowed in OSGi declarative services with
@Component
annotation.Would it be possible to support any interfaces as extension points?
The text was updated successfully, but these errors were encountered: