Set<String> (PsiMethod method) { Set<String> result = new HashSet<>(); PsiTreeUtil.processElements(method, child -> { if (child instanceof PsiComment psiComment && !(psiComment instanceof PsiDocComment)) { String text = TryWithIdenticalCatchesInspection.getCommentText(psiComment); if (!text.isEmpty()) { result.add(text); } } return true; }); return result; }