void (@NotNull PsiPolyadicExpression expression) { super.visitPolyadicExpression(expression); final IElementType tokenType = expression.getOperationTokenType(); if (!JavaTokenType.PLUS.equals(tokenType)) { return; } final PsiType type = expression.getType(); if (!TypeUtils.isJavaLangString(type)) { return; } final PsiExpression[] operands = expression.getOperands(); for (PsiExpression operand : operands) { if (NonNlsUtils.isNonNlsAnnotated(operand)) { return; } } if (AnnotationUtil.isInsideAnnotation(expression)) { return; } if (ignoreAsserts) { final PsiAssertStatement assertStatement = PsiTreeUtil.getParentOfType(expression, PsiAssertStatement.class, true, PsiCodeBlock.class, PsiClass.class); if (assertStatement != null) { return; } } if (ignoreSystemErrs || ignoreSystemOuts) { final PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(expression, PsiMethodCallExpression.class, true, PsiCodeBlock.class, PsiClass.class); if (methodCallExpression != null) { final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); @NonNls final String canonicalText = methodExpression.getCanonicalText(); if (ignoreSystemOuts && "System.out.println".equals(canonicalText) || "System.out.print".equals(canonicalText)) { return; } if (ignoreSystemErrs && "System.err.println".equals(canonicalText) || "System.err.print".equals(canonicalText)) { return; } } } if (ignoreThrowableArguments) { if (ExceptionUtils.isExceptionArgument(expression)) return; } if (ignoreConstantInitializers) { PsiElement parent = expression.getParent(); while (parent instanceof PsiBinaryExpression) { parent = parent.getParent(); } if (parent instanceof PsiField field) { if (field.hasModifierProperty(PsiModifier.STATIC) && field.hasModifierProperty(PsiModifier.FINAL)) { return; } final PsiClass containingClass = field.getContainingClass(); if (containingClass != null && containingClass.isInterface()) { return; } } } if (ignoreInToString) { final PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class, true, PsiClass.class, PsiLambdaExpression.class); if (MethodUtils.isToString(method)) { return; } } if (NonNlsUtils.isNonNlsAnnotatedUse(expression)) { return; } for (int i = 1; i < operands.length; i++) { final PsiExpression operand = operands[i]; if (!ExpressionUtils.isStringConcatenationOperand(operand)) { continue; } final PsiJavaToken token = expression.getTokenBeforeOperand(operand); if (token == null) { continue; } registerError(token, expression); } }