Long (@NotNull PsiExpression expression) { Object constantValue = JavaConstantExpressionEvaluator.computeConstantExpression(expression, null, false); if (constantValue instanceof Long || constantValue instanceof Integer || constantValue instanceof Short || constantValue instanceof Byte) { return ((Number)constantValue).longValue(); } return null; }