jakartaee / messaging

Jakarta Messaging
https://eclipse.org/ee4j/messaging
Other
39 stars 32 forks source link

CDI Stereotypes #245

Open dblevins opened 4 years ago

dblevins commented 4 years ago

TODO

Proposals

Related

t1 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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?