void (@NotNull PsiMethod method) { super.visitMethod(method); final PsiReferenceList throwsList = method.getThrowsList(); final PsiJavaCodeReferenceElement[] referenceElements = throwsList.getReferenceElements(); for (PsiJavaCodeReferenceElement referenceElement : referenceElements) { final PsiElement target = referenceElement.resolve(); if (!(target instanceof PsiClass aClass)) { continue; } if (!InheritanceUtil.isInheritor(aClass, "java.lang.RuntimeException")) { continue; } final String className = aClass.getName(); registerError(referenceElement, className, referenceElement); } }