@Override public void recordField(@NotNull JavaField field, @NotNull PropertyDescriptor descriptor) { PsiField psiField = ((JavaFieldImpl) field).getPsi(); trace.record(VARIABLE, psiField, descriptor); if (AnnotationUtils.isPropertyCompileTimeConstant(descriptor)) { PsiExpression initializer = psiField.getInitializer(); Object evaluatedExpression = JavaConstantExpressionEvaluator.computeConstantExpression(initializer, false); if (evaluatedExpression != null) { CompileTimeConstant<?> constant = JavaAnnotationArgumentResolver.resolveCompileTimeConstantValue( evaluatedExpression, descriptor.getType()); if (constant != null) { trace.record(COMPILE_TIME_INITIALIZER, descriptor, constant); } } } }
@Nullable private static Object compute(@NotNull PsiExpression expr) { return JavaConstantExpressionEvaluator.computeConstantExpression(expr, true); }