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

CDI Stereotypes #245

Open
dblevins opened this issue Sep 29, 2019 · 3 comments
Open

CDI Stereotypes #245

dblevins opened this issue Sep 29, 2019 · 3 comments
Labels
4.0 CDI integration Improvements related to fit better with the CDI programming model New Feature use case

Comments

@dblevins
Copy link
Contributor

dblevins commented Sep 29, 2019

TODO

Proposals

Related

@t1
Copy link

t1 commented Dec 16, 2020

@dblevins: Something for the 'Related' section that I'm sure you'll love to hear about: the MP GraphQL team is working on supporting Stereotypes (and more), too. We try to extract that into a separate standard (for lack of a better name it's code named power annotations), to make it easier for others to adopt, as the more implementations and standards support it, the better for everybody. The current implementation is based on Jandex so everything Quarkus should work out of the box (testing is ongoing); but the api is agnostic and the TCK should be able to test any other implementation, too. We'd be very happy to hear what you think!

@dblevins
Copy link
Contributor Author

dblevins commented Dec 17, 2020

Having something like Stereotypes that's generic to plain Java has been the dream. Any efforts to support it are incredibly welcome. A recommendation on a better name is "Meta Annotations". I've tried to convince a handful of people on the Java SE team of its merit but haven't gotten far.

If you guys are interested in a generic proposal not connected to CDI, let's collaborate. Several years ago I created this generic library that passively added support for a new "@metatype" annotation.

We could potentially create a new very thin spec project, add something like 'jakarta.meta.Metatype' and expand the idea. Looks like you've got some Mixin concept I'd definitely like to learn more about.

I never actually liked "Stereotype" as a name as "stereo" has kind of a narrow "two" definition; does that imply the other annotations are "Monotypes"?; what if the annotation implies multiple things? I like "meta-annotation" as "meta" means "referring to itself or to the conventions of its genre; self-referential", which is great for annotations that describe annotations or, more accurately, an annotation that uses annotations to describe itself.

@t1
Copy link

t1 commented Dec 17, 2020

I was curious, so I looked it up: stereotype translates as solid-print; the meaning 'two' is just a coincidence. I'm fine with calling it MetaTypes, esp. as stereotypes applied to people has such a negative connotation; but renaming it may be an additional effort when struggling for acceptance; and Stereotype has a strong UML background.

I was aware of your metatype project and IIRC we talked about it at Devoxx BE. Then I actually experimented with an annotation processor to do the resolution at compile time. It works even with EJB annotations like @Stateless. But manipulating the Java syntax tree at compile time is something that not everybody likes: I regularly use Lombok, for example, but some people really hate it; I'm not sure why.

A request for mixins actually was the trigger for this in the MP GraphQL community. Sometimes you really need mixins so you can add annotations to classes you don't own.

You're probably aware that Spring has meta annotations with a lot of additional features. The JEE world needs something similar. Maybe now is the time for trying to push the topic again... step by step; Microprofile may be a chance to get this widely supported. Should we perhaps create a sandbox project?

@OndroMih OndroMih added the CDI integration Improvements related to fit better with the CDI programming model label Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.0 CDI integration Improvements related to fit better with the CDI programming model New Feature use case
Projects
None yet
Development

No branches or pull requests

3 participants