void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiMethodCallExpression call = ObjectUtils.tryCast(element, PsiMethodCallExpression.class); if (call == null) return; final PsiExpression qualifier = call.getMethodExpression().getQualifierExpression(); if (qualifier == null) return; PsiExpression strippedQualifier = PsiUtil.deparenthesizeExpression(qualifier); if (strippedQualifier == null) return; final CommentTracker ct = new CommentTracker(); PsiElement result = ct.replace(qualifier, "new java.util.HashSet<>(" + ct.text(strippedQualifier) + ")"); JavaCodeStyleManager.getInstance(project).shortenClassReferences(result); }