boolean (@NotNull PsiMethod method, String @NotNull ... exceptions) { if (exceptions.length == 0) { throw new IllegalArgumentException("no exceptions specified"); } final PsiReferenceList throwsList = method.getThrowsList(); final PsiJavaCodeReferenceElement[] references = throwsList.getReferenceElements(); for (PsiJavaCodeReferenceElement reference : references) { ProgressManager.checkCanceled(); final PsiElement target = reference.resolve(); if (!(target instanceof PsiClass aClass)) { continue; } final String qualifiedName = aClass.getQualifiedName(); if (ArrayUtil.contains(qualifiedName, exceptions)) return true; } return false; }