boolean (@NotNull PsiElement expression) { int count = 0; for (PsiElement element = getInnerExpression(expression); element != null; element = getInnerExpression(element)) { count++; if (count > 1) { // expression chains like 'var.foo().bar()' and 'var.foo[i].bar()' are too long return true; } } return false; }