Missing annotation values for array of static imports #2694
Labels
bug
feedback: Google
An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs
language: Java
Issue/PR related to the Java language feature/analysis/docs
Describe the bug
Followup to #2580, the fix for that bug works when a static import is directly used as an annotation param. However, when the param is instead an array of static imports, it ends up as an empty array in the docs.
Expected behaviour
I would expect an array of constant values, like what #2593 did for a single static import annotation param value. Alternatively, the name of the value linked to its definition would also work.
To Reproduce
Here's a (failing) test for the expected behavior:
(Fails with
expected: <ArrayValue(value=[STRING_CONSTANT_VALUE_1, STRING_CONSTANT_VALUE_2])> but was: <ArrayValue(value=[])>
)When converting the annotations in
DefaultPsiToDocumentableTranslator
, each element of the array falls into thePsiReferenceExpression
case ofPsiAnnotationMemberValue.toValue()
, but thepsiReference
ends upnull
, so the array ends up empty:Are you willing to provide a PR?
I haven't found an obvious way to use a similar solution to #2593 to get the constant values, hoping I'm missing something. All I have is a hacky workaround to link to the definitions by comparing the
referenceName
of thePsiReferenceExpression
to each static import line from the file.The text was updated successfully, but these errors were encountered: