void (@NotNull Project project, @NotNull PsiElement startElement, @NotNull ModPsiUpdater updater) { PsiElement current = startElement; while (current.getParent() instanceof PsiParenthesizedExpression) { current = current.getParent(); } if (!(current instanceof PsiExpression expression)) { return; } final PsiElement parent = expression.getParent(); if (!(parent instanceof PsiPolyadicExpression polyadicExpression)) { return; } PsiType polyadicExpressionType = polyadicExpression.getType(); if (polyadicExpressionType == null || !polyadicExpressionType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) { return; } PsiExpression[] operands = polyadicExpression.getOperands(); //for fix all case, but I think, it is impossible if (operands.length == 1) { return; } if (operands.length == 2) { fixBinaryExpression(polyadicExpression); return; } boolean seenString = Stream.of(operands) .takeWhile(t -> t != expression) .anyMatch(t -> t.getType() != null && t.getType().equalsToText(CommonClassNames.JAVA_LANG_STRING)); if (operands[0] == expression) { PsiType type2 = operands[2].getType(); if (type2 != null && type2.equalsToText(CommonClassNames.JAVA_LANG_STRING)) { seenString = true; } } if (operands[operands.length - 1] == expression) { fixLastExpression(polyadicExpression, seenString); } else { fixExpressionInMiddle(expression, polyadicExpression, seenString); } }