Object (@NotNull PsiExpression expression, @NotNull PsiType castTo, @Nullable Set<PsiVariable> visitedVars) { Object value = JavaConstantExpressionEvaluator.computeConstantExpression(expression, visitedVars, false); if (value == null) return null; return ConstantExpressionUtil.computeCastTo(value, castTo); }