[java] Expose symbol annotations#4243
Conversation
- Only type annotations are missing from ASM, but those are a world of pain…
- Improve ASM parsing speed
oowekyala
left a comment
There was a problem hiding this comment.
This looks fine to me, thanks! I have a couple of minor comments.
I implemented type annotation recovery from ASM in this branch. This does no interfere with your effort I think, but that may be a candidate for the next PR, to avoid diverging
…nternal/ast/AbstractAstExecSymbol.java Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
…nternal/ast/AstClassSym.java Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
…nternal/ast/AbstractAstVariableSym.java Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
Generated by 🚫 Danger |
|
This should be ready now! @oowekyala, as for how to let type annotations flow through type inference, keeping equality and what not… I've been thinking, maybe an option here is to do something similar to what Java'a reflection API actually does. Have the "annotated" types be wrappers on the standard types, and expose both (ie: I'm yet to take a look into what you did with https://github.com/oowekyala/pmd/tree/clem.type-annotations-support, but hope this helps. Let me know if I can assist you in any way with this. |
Describe the PR
This PR takes on @oowekyala's work on symbol annotations (see #4241) and expands on it to finalize it with a few minor improvements along the way.
Notice this PR focuses solely on symbolic annotations, that is, those that Java reflection will retrieve through
AnnotatedElement.getDeclaredAnnotations(), which excludes both those withTargetElementType.TYPE_USEandElementType.TYPE_PARAMETER, as those are actually impacting on the types (and in the reflection API obtainable only throughgetAnnotated*Type()family of methods. Targeting those are a next step, but both, independent, and massive enough to be worth a separate PR.Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)