void (PsiElement anchor, StringBuilder out, String commentsBefore) { final boolean operationSignOnNextLine = CodeStyle.getLanguageSettings(anchor.getContainingFile(), JavaLanguage.INSTANCE).BINARY_OPERATION_SIGN_ON_NEXT_LINE; final int lineNumber = getLineNumber(anchor); final boolean insertNewLine = currentLine != lineNumber; final boolean notEmpty = !out.isEmpty(); if (notEmpty && !operationSignOnNextLine) { out.append(insertNewLine ? '+' + commentsBefore : commentsBefore + '+'); } else { out.append(commentsBefore); } if (insertNewLine && notEmpty && !hasTrailingLineBreak(out)) { out.append("\n "); // space is added to force line reformatting if the next line starts with comment } if (notEmpty && operationSignOnNextLine) { out.append('+'); } currentLine = lineNumber; }