-
Notifications
You must be signed in to change notification settings - Fork 94
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
Read RuntimeInvisible*Annotations in Indexer #129
Conversation
My understanding is that this was a deliberate decision :-) Perhaps also to make the index smaller. Not sure if these annotations should be accessible by default, or if opt-in should be required... Side note: |
2310831
to
36da74f
Compare
Thanks for the feedback. I fixed the indentation in the |
I ran a test indexing the quarkus-app/lib jars for a "typical" Quarkus application with Resteasy, Hibernate, and some Camel libraries. The runtime-invisible annotations results in about an additional 1 MB of heap (56M before -> 57M). That could be mostly eliminated with an opt-in switch that could be used to selectively scan the invisible annotations, e.g. only for the application classes and not for dependencies. Does that sound reasonable? If so, do you have any opinion on the form of the option/switch? Using a system property is my suggestion. Something like a boolean named |
This is something we should definitely do, since we have had real asks for this. A great example is the Kotlin null annotations. That said, I have been unsure about how we handle the "surprise" of annotations showing up in Jandex but not via reflection, which could lead to framework errors. There probably should be a flag on the annotation to mark whether or not it's visible, but do we need to go a step further and propvide mechanisms to filter (e.g. boolean includeInvisible)? If we filter on the top map API entry points (E.g. calls via Index.), what about people browsing from the class to the annotations. My instinct is that its not worth API filtering, and we should just present them all with some flag to know the visibility. A good time to make this change would be in 3 since its a significant behavioral difference (new stuff showing up that didnt before). Thoughts? |
Yea I agree. |
�(BTW just for some background that's why it was not originally introduced in Jandex, there was no demand at the time, and the reflection inconsistency was a concern) |
That's the exact impetus for this PR :-). I did some experimentation with making If that sounds like a reasonable approach, I'll clean up what I have and update this PR with the commit. |
One additional question - if this is for 3.0, does anyone still think there is a need to enable the invisible annotations via a system property, or some other mechanism like what is in this PR currently? |
I think I'd probably prefer to keep the We could probably cheat and store a marker value into the |
Also, no, I don't think we need an opt-in anymore. I originally thought it doesn't matter so much whether runtime-invisible annotations are present in the index or not. What does matter is the set of annotations returned by the API. But if we put this into 3.0, it sounds palatable. |
4d6fd30
to
3bb1265
Compare
Rebased on |
I saw your comment in #124 and I'll rebase this and target the |
- Add runtimeVisible boolean to AnnotationInstance Signed-off-by: Michael Edgar <[email protected]>
3bb1265
to
6b177c9
Compare
Ah I didn't expect you to react so quickly :-) Well, maybe I can merge this as is then :-) I'll take a look. Thanks! |
Making Out of the 3 comments I added, 2 of them are I believe logical errors that need to be fixed. The other is a matter of style, so... :-) |
Noticed one more mistake, which slipped through because a there wasn't a test. The test proposal I suggested should cover that. |
} | ||
|
||
assertEquals(1, placements.get("class").size()); | ||
// @RuntimeInvisible recorded on both method parameter and method parameter type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting, but correct I guess? Since the annotation has ElementType.PARAMETER, ElementType.TYPE_USE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, exactly. I wasn't expecting it initially, but it makes sense.
Looks good, thanks! I added one commit to your branch to somewhat simplify how Please let me know if that looks OK to you, and I'll merge this. |
The |
Fixes #120 - I'm hoping they were not excluded deliberately originally :-) This also includes a refactoring of
processAttributes
to use a switch statement for readability.