@Contract(pure = true)
    private static @NotNull Map<@NotNull PsiFile, @NotNull Set<@NotNull PsiTryStatement>> getFilesWithTryStatements(@NotNull PsiMethod method) {
      final Collection<PsiReference> references = ReferencesSearch.search(method).findAll();

      final Map<@NotNull PsiFile, @NotNull Set<@NotNull PsiTryStatement>> tryStatementsInFile = new HashMap<>();

      for (final PsiReference reference : references) {
        if (!(reference instanceof PsiElement element)) continue;

        final PsiFile file = element.getContainingFile();

        final PsiClass clazz = PsiTreeUtil.getParentOfType(element, PsiClass.class);

        PsiTreeUtil.treeWalkUp(element, clazz, (curr, prev) -> {
          if (curr instanceof PsiTryStatement) {
            final Set<PsiTryStatement> tryStatements = tryStatementsInFile.computeIfAbsent(file, k -> new HashSet<>());
            tryStatements.add((PsiTryStatement)curr);
          }
          return true;
        });
      }
      return tryStatementsInFile;
    }
@Contract(pure = true)
    private static @NotNull Map<@NotNull PsiFile, @NotNull Set<@NotNull PsiTryStatement>> getFilesWithTryStatements(@NotNull PsiMethod method)