void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (!(element instanceof PsiComment comment)) { return; } if (comment.getTokenType() == JavaTokenType.END_OF_LINE_COMMENT) { final List<PsiElement> toDelete = new ArrayList<>(); toDelete.add(comment); PsiElement sibling = PsiTreeUtil.skipWhitespacesForward(comment); while (sibling instanceof PsiComment && ((PsiComment)sibling).getTokenType() == JavaTokenType.END_OF_LINE_COMMENT) { toDelete.add(sibling); sibling = PsiTreeUtil.skipWhitespacesForward(sibling); } toDelete.forEach(PsiElement::delete); } else { element.delete(); } }