ExtractableExpressionPart (@NotNull PsiExpression expression) { PsiConstantEvaluationHelper constantHelper = JavaPsiFacade.getInstance(expression.getProject()).getConstantEvaluationHelper(); Object value = constantHelper.computeConstantExpression(expression, false); if (value != null) { PsiType type = expression.getType(); if (type != null) { return new ExtractableExpressionPart(expression, null, value, type); } } return null; }