PsiElement (List<String> commentTexts, PsiElement element) { List<String> mightBeCommentTexts = new ArrayList<>(); for (PsiElement currentSibling = element.getNextSibling(); currentSibling != null; currentSibling = currentSibling.getNextSibling()) { if (currentSibling instanceof PsiWhiteSpace whiteSpace) { if (whiteSpace.textContains('\n')) { commentTexts.addAll(mightBeCommentTexts); return currentSibling; } else { continue; } } else if (currentSibling instanceof PsiComment) { TryWithIdenticalCatchesInspection.collectCommentTexts(currentSibling, mightBeCommentTexts); continue; } return currentSibling; } return element; }