-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve annotation literals generation in ArC #25560
Conversation
Marking as draft for now, because I want to discuss one thing and don't want to pollute CI until that is settled. @mkouba There's one thing that technically breaks compatibility: where the [semi-]public API used to expose |
Maybe renaming |
44631ef
to
accbdc1
Compare
Okay, I tried reverting those changes that break compatibility, even though I believe |
I have to admit that I don't fully understand the need to merge those two classes. In fact, I created two separate classes intentionally because they do different things. |
These two classes share so many internal assumptions and data structures it made sense to me to merge them. That was the only way I could understand the code and extend it to support all types of annotation members. I admit the javadoc as present in this PR is focused more on the generation part, and I can improve that probably :-) But if you look at the |
e1cc7d3
to
ee9fbab
Compare
I tried to improve the Now, if you insist the merge is a bad idea, I can split them again. I would probably be able to do that, now that I understand how the code is supposed to work :-) |
I like this idea. I don't remember the details why we kept the possibility of one-off annotation literals but given the fact that it's shared by default ( |
That sounds good to me. I'll try to prepare a (2nd?) PR. For backward compatibility, we'll have to keep the old |
I'd keep the old |
OK, just got back to this, sorry it took me so long (see smallrye/jandex#206 if you wanna know why :-) ). I started splitting the class back into two and found there's an actual need to merge them: nested annotations. If I use (Note that this entails an interesting problem. |
Okay, the problem I mentioned above only appears for one-off annotation literals. For shared ones, the nested annotation classes are generated during the initial |
OK, when I remove one-off annotation literals, pretty clean separation between |
Ok, nested annotations were not supported before (because the
I do trust your judgment and if you believe it would be better to split them, go ahead! ;-) |
I'll keep them separate, because after removing one-off annotation literals, the separation is actually possible and meaningful. Just FYI, we need nested annotations for CDI Lite, or Build Compatible Extensions specifically. Synthetic beans in BCE allow passing arbitrary annotations from build time to runtime. (Which I think is a reasonable compromise between expressivity and simplicity.) More PRs related to that will be coming :-) |
c6c1529
to
ade7efa
Compare
ade7efa
to
3ac877e
Compare
I think this is ready now. |
This commit adds support for emitting annotation literal classes with all possible annotation member types: all primitive types, strings, enums, classes, nested annotations, and arrays of previously mentioned types. A test for the annotation literal class generator is added, too. Additionally, this commit removes the ability to generate "one-off" annotation literal classes. They are now always shared. This allows simplification of the `AnnotationLiteralProcessor` and `AnnotationLiteralGenerator` classes. These classes now maintain separation between generating an annotation literal class and generating a bytecode sequence to instantiate it. The previous user-visible APIs that dealed with "one-off" annotation literals are now deprecated.
3ac877e
to
a16c375
Compare
Rebased + got rid of a duplicate assertion in the test. |
Merged, thanks! |
Thank you! |
This commit adds support for emitting annotation literal classes with all
possible annotation member types: all primitive types, strings, enums,
classes, nested annotations, and arrays of previously mentioned types.
A test for the annotation literal class generator is added, too.
Additionally, this commit removes the ability to generate "one-off" annotation
literal classes. They are now always shared. This allows simplification of
the
AnnotationLiteralProcessor
andAnnotationLiteralGenerator
classes.These classes now maintain separation between generating an annotation
literal class and generating a bytecode sequence to instantiate it.
The previous user-visible APIs that dealed with "one-off" annotation literals
are now deprecated.