Parse enum arrays correctly

(cherry picked from commit 5f2b5cf)
This commit is contained in:
Yan Zhulanow
2016-10-04 20:55:52 +03:00
committed by Yan Zhulanow
parent f15f90a719
commit 82160bc86d
3 changed files with 24 additions and 5 deletions
@@ -92,8 +92,12 @@ private fun getConstantValue(
is PsiArrayInitializerMemberValue -> psiValue.initializers.toList()
else -> listOf(psiValue)
}
if (jComponentType.isPrimitive || jComponentType.isAnnotation || jComponentType.canonicalName == JAVA_LANG_STRING) {
if (jComponentType.isPrimitive
|| jComponentType.isAnnotation
|| jComponentType.isEnum
|| jComponentType.canonicalName == JAVA_LANG_STRING
) {
val arr = Array.newInstance(jComponentType, arrayValues.size)
arrayValues.forEachIndexed { i, componentPsiValue ->
val componentValue = getConstantValue(componentPsiValue, returnType.componentType, jComponentType, evaluator)