StreamEx<PsiElement> (@Nullable final RefMethod refMethod, @NotNull final PsiMethod psiMethod, @NotNull final PsiJavaCodeReferenceElement ref) { final StreamEx<PsiElement> res = StreamEx.of(ref); if (refMethod == null) return res; final PsiDocComment comment = psiMethod.getDocComment(); if (comment == null) return res; final PsiClass[] unThrown = refMethod.getUnThrownExceptions(); if (unThrown == null) return res; final List<PsiClassType> redundantThrows = RedundantThrowsDeclarationLocalInspection.getRedundantThrowsCandidates(psiMethod, myIgnoreEntryPoints) .map(ThrowRefType::getType) .filter(type -> ArrayUtil.contains(type.resolve(), unThrown)) .toList(); final StreamEx<PsiDocTag> javadocThrows = StreamEx.of(comment.getTags()) .filterBy(PsiDocTag::getName, "throws"); // if there is only one element in the throws list and there is one redundant throws element, // it must be the same element, so return all the @throws tags that are in the javadoc final PsiJavaCodeReferenceElement[] throwsListElements = psiMethod.getThrowsList().getReferenceElements(); if (throwsListElements.length == 1 && redundantThrows.size() == 1) { return res.append(javadocThrows); } final StreamEx<PsiDocTag> relatedJavadocThrows = javadocThrows .filter(tag -> isTagRelatedToRedundantThrow(tag, redundantThrows)); return res.append(relatedJavadocThrows); }