StreamEx<ThrowRefType> (@Nullable final PsiMethod method, final boolean ignoreEntryPoints) { if (method == null) return StreamEx.empty(); if (method instanceof SyntheticElement) return StreamEx.empty(); if (ignoreEntryPoints && UnusedDeclarationInspectionBase.isDeclaredAsEntryPoint(method)) return StreamEx.empty(); if (method.hasModifier(JvmModifier.NATIVE)) return StreamEx.empty(); if (JavaHighlightUtil.isSerializationRelatedMethod(method, method.getContainingClass())) return StreamEx.empty(); final PsiReferenceList throwsList = method.getThrowsList(); checkInconsistency(throwsList, method.getClass().getSimpleName()); final PsiJavaCodeReferenceElement[] referenceElements = throwsList.getReferenceElements(); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(method.getProject()); return StreamEx.of(referenceElements) .map(ref -> new ThrowRefType(ref, factory.createType(ref))) .filter(ThrowRefType::isCheckedException) .filter(p -> !p.isRemoteExceptionInRemoteMethod(method)); }