PsiElement[] (PsiMethod method, PsiType exceptionType) { List<PsiElement> refs = new SmartList<>(); PsiJavaCodeReferenceElement[] referenceElements = method.getThrowsList().getReferenceElements(); PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(method.getProject()); Arrays.stream(referenceElements).filter(ref -> { PsiType refType = elementFactory.createType(ref); return exceptionType.isAssignableFrom(refType); }).forEach(refs::add); PsiDocComment comment = method.getDocComment(); if (comment != null) { Arrays .stream(comment.getTags()) .filter(tag -> "throws".equals(tag.getName())) .filter(tag -> { PsiClass tagValueClass = JavaDocUtil.resolveClassInTagValue(tag.getValueElement()); if (tagValueClass == null) return false; PsiClassType tagValueType = elementFactory.createType(tagValueClass); return exceptionType.isAssignableFrom(tagValueType); }) .forEach(refs::add); } return refs.toArray(PsiElement.EMPTY_ARRAY); }