Fix tests with annotations: enum constants are now resolved as constants in JavaConstantExpressionEvaluator
This commit is contained in:
committed by
Nikolay Krasko
parent
601a33f772
commit
43249e928c
+3
@@ -26,6 +26,9 @@ abstract class JavaAnnotationArgumentImpl(
|
|||||||
class object {
|
class object {
|
||||||
fun create(argument: PsiAnnotationMemberValue, name: Name?): JavaAnnotationArgument {
|
fun create(argument: PsiAnnotationMemberValue, name: Name?): JavaAnnotationArgument {
|
||||||
val value = JavaPsiFacade.getInstance(argument.getProject()).getConstantEvaluationHelper().computeConstantExpression(argument)
|
val value = JavaPsiFacade.getInstance(argument.getProject()).getConstantEvaluationHelper().computeConstantExpression(argument)
|
||||||
|
if (value is Enum<*>) {
|
||||||
|
return JavaEnumValueAnnotationArgumentImpl(argument as PsiReferenceExpression, name)
|
||||||
|
}
|
||||||
if (value != null || argument is PsiLiteralExpression) {
|
if (value != null || argument is PsiLiteralExpression) {
|
||||||
return JavaLiteralAnnotationArgumentImpl(name, value)
|
return JavaLiteralAnnotationArgumentImpl(name, value)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user