void (@NotNull PsiMethodCallExpression call) { if (STRING_CHAR_AT.test(call)) { PsiLiteralExpression qualifier = tryCast(PsiUtil.skipParenthesizedExprDown(call.getMethodExpression().getQualifierExpression()), PsiLiteralExpression.class); if (qualifier == null) return; Integer index = getIndex(call.getArgumentList().getExpressions()[0]); if (index == null) return; String value = tryCast(qualifier.getValue(), String.class); if (value == null || index >= value.length()) return; myHolder.registerProblem(call, InspectionGadgetsBundle.message("inspection.only.one.element.used.string"), new InlineSingleElementAccessFix("'" + StringUtil.escapeCharCharacters(String.valueOf(value.charAt(index)))+"'")); } else if (LIST_GET.test(call)) { PsiMethodCallExpression qualifier = tryCast(PsiUtil.skipParenthesizedExprDown(call.getMethodExpression().getQualifierExpression()), PsiMethodCallExpression.class); if (!LIST_CONSTRUCTOR.test(qualifier)) return; PsiMethod method = qualifier.resolveMethod(); if (method == null) return; if (method.isVarArgs() && !MethodCallUtils.isVarArgCall(qualifier)) return; Integer index = getIndex(call.getArgumentList().getExpressions()[0]); if (index == null) return; PsiExpression[] expressions = qualifier.getArgumentList().getExpressions(); if (index >= expressions.length) return; myHolder.registerProblem(call, InspectionGadgetsBundle.message("inspection.only.one.element.used.list"), new InlineSingleElementAccessFix(expressions[index].getText())); } }