public static boolean areStringParenthesesNeeded(@NotNull PsiPolyadicExpression childStringConcatenation,
                                                   @NotNull PsiPolyadicExpression parentStringConcatenation,
                                                   @Nullable PsiElement anchor) {
    PsiExpression[] childOperands = childStringConcatenation.getOperands();
    PsiType firstType = childOperands[0].getType();
    if (firstType != null && firstType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
      return false;
    }
    PsiType secondType = childOperands[1].getType();
    if (secondType != null && !secondType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
      return true;
    }
    PsiExpression[] parentOperands = parentStringConcatenation.getOperands();
    PsiType firstParentType = parentOperands[0].getType();
    if (firstParentType != null && firstParentType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
      return false;
    }
    if (anchor == null) {
      anchor = childStringConcatenation;
    }
    for (int i = 1; i < parentOperands.length; i++) {
      PsiExpression operand = parentOperands[i];
      if (PsiTreeUtil.isAncestor(operand, anchor, false)) {
        return true;
      }
      final PsiType type = operand.getType();
      if (type != null && type.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
        return false;
      }
    }
    return false;
  }
public static boolean areStringParenthesesNeeded(@NotNull PsiPolyadicExpression childStringConcatenation,
                                                   @NotNull PsiPolyadicExpression parentStringConcatenation,
                                                   @Nullable PsiElement anchor)