boolean (PsiExpression expression) { int preventEndlessLoop = 5; expression = PsiUtil.skipParenthesizedExprDown(expression); while (expression instanceof PsiReferenceExpression) { if (--preventEndlessLoop == 0) return false; expression = findFinalVariableDefinition((PsiReferenceExpression)expression); } if (expression instanceof PsiNewExpression || expression instanceof PsiArrayInitializerExpression || expression instanceof PsiClassObjectAccessExpression) { return true; } return PsiUtil.isConstantExpression(expression); }