boolean (@NotNull PsiExpression expression, @NotNull List<PsiExpression> joinParts) { PsiMethodCallExpression methodCallExpression = tryCast(expression, PsiMethodCallExpression.class); if (methodCallExpression != null) { if (!APPEND.test(methodCallExpression)) return false; PsiExpression appendArgument = methodCallExpression.getArgumentList().getExpressions()[0]; PsiExpression qualifierExpression = methodCallExpression.getMethodExpression().getQualifierExpression(); if (qualifierExpression == null) return false; PsiReferenceExpression referenceExpression = tryCast(qualifierExpression, PsiReferenceExpression.class); if (referenceExpression == null) { // assume expr like sb.append(a).append(b).append(c) if (!tryExtractJoinPart(qualifierExpression, joinParts)) return false; } if (!tryExtractConcatenationParts(appendArgument, joinParts)) return false; return true; } return false; }