void (@NotNull Project project, @NotNull PsiMethodCallExpression call) { PsiExpression arg = call.getArgumentList().getExpressions()[0]; PsiMethodCallExpression removeArg = tryCast(ExpressionUtils.resolveExpression(arg), PsiMethodCallExpression.class); if (removeArg == null) return; PsiExpression indexOfArg = ArrayUtil.getFirstElement(removeArg.getArgumentList().getExpressions()); if (indexOfArg == null) return; CommentTracker ct = new CommentTracker(); String text = ct.text(indexOfArg); if (PsiTypes.intType().equals(indexOfArg.getType())) { text = "(" + CommonClassNames.JAVA_LANG_INTEGER + ")" + text; } if (!PsiTreeUtil.isAncestor(call, removeArg, false)) { PsiDeclarationStatement declaration = PsiTreeUtil.getParentOfType(removeArg, PsiDeclarationStatement.class); if (declaration == null) return; ct.delete(declaration); } ct.replaceAndRestoreComments(arg, text); }