void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); if (!isMessageFormatCall(expression)) { return; } final PsiExpressionList argumentList = expression.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length == 0) { return; } final PsiExpression firstArgument = arguments[0]; final PsiType type = firstArgument.getType(); if (type == null) { return; } final int formatArgumentIndex; if ("java.util.Locale".equals(type.getCanonicalText()) && arguments.length > 1) { formatArgumentIndex = 1; } else { formatArgumentIndex = 0; } final PsiExpression formatArgument = arguments[formatArgumentIndex]; final PsiType formatArgumentType = formatArgument.getType(); if (formatArgumentType == null || !formatArgumentType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) { return; } if (!(formatArgument instanceof PsiBinaryExpression binaryExpression)) { return; } if (PsiUtil.isConstantExpression(formatArgument)) { return; } final PsiExpression lhs = binaryExpression.getLOperand(); final PsiType lhsType = lhs.getType(); if (lhsType == null || !lhsType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) { return; } final PsiExpression rhs = binaryExpression.getROperand(); if (!(rhs instanceof PsiReferenceExpression)) { return; } registerError(formatArgument, rhs); }