Set<PsiClassType> (@Nullable PsiElement element, @NotNull Set<PsiClassType> out) { if (element == null) return out; if (element instanceof PsiResourceList resourceList) { for (PsiResourceListElement resource : resourceList) { out.addAll(ExceptionUtil.getCloserExceptions(resource)); } } final ExceptionsThrownVisitor visitor = new ExceptionsThrownVisitor(out); element.accept(visitor); return out; }