Fix various java annotation parsing issues #146
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes multiple issues in annotation parsing for java code
When getting annotation names, it was always using the index instead
of the name. I changed it to default to name and only use index if
name is not provided.
Array values in annotations were repoted as a list of pairs instead
of 1 key and multiple values, fixed.
When the annotation value is a type, it was not returning a KSType
but instead returning a PsiType, fixed.
When the annotation value is another annotation, it was not returning
a KSAnnotation, fixed.
For expressions resolving to literals, it was returning the PsiLiteral
instead of the value of it.
TypeReferences (relevant in enum values) were not being resolved.
Updated/added tests for all cases above.
The enum fix for java source is not great right now because seems like
evaluator does not resolve it, hence I implemented a manual resolution that
is very similar to the implementation in KSAnnotationImpl.