void (@NotNull PsiMethodCallExpression call, @NotNull List<MessageFormatUtil.MessageFormatPlaceholder> indexes) { PsiExpression[] expressions = call.getArgumentList().getExpressions(); for (PsiExpression expression : expressions) { if (expression == null || expression instanceof PsiEmptyExpressionImpl) { return; } } int count = call.getArgumentList().getExpressionCount(); int argumentNumber = count - 1; List<Integer> notFoundArguments = new ArrayList<>(); Set<Integer> usedArgumentIndexes = new HashSet<>(); for (MessageFormatUtil.MessageFormatPlaceholder index : indexes) { if (index.index() >= argumentNumber) { notFoundArguments.add(index.index()); } usedArgumentIndexes.add(index.index()); } List<Integer> notUsedArguments = new ArrayList<>(); for (int i = 0; i < argumentNumber; i++) { if (!usedArgumentIndexes.contains(i)) { notUsedArguments.add(i); } } if (notFoundArguments.isEmpty() && notUsedArguments.isEmpty()) { return; } PsiIdentifier[] identifiers = PsiTreeUtil.getChildrenOfType(call.getMethodExpression(), PsiIdentifier.class); if (identifiers == null || identifiers.length != 1) { return; } PsiIdentifier identifier = identifiers[0]; if (!notFoundArguments.isEmpty()) { if (notFoundArguments.size() == 1) { holder.registerProblem(identifier, InspectionGadgetsBundle.message("inspection.incorrect.message.format.not.found.argument", notFoundArguments.iterator().next())); } else { StringJoiner joiner = new StringJoiner(", "); for (Integer notFoundArgument : notFoundArguments) { joiner.add(notFoundArgument.toString()); } holder.registerProblem(identifier, InspectionGadgetsBundle.message("inspection.incorrect.message.format.not.found.arguments", joiner.toString())); } } if (!notUsedArguments.isEmpty()) { for (Integer notUsedArgument : notUsedArguments) { int expressionIndex = notUsedArgument + 1; PsiExpression expression = expressions[expressionIndex]; holder.registerProblem(expression, InspectionGadgetsBundle.message("inspection.incorrect.message.format.not.used.argument", notUsedArgument)); } } }