private static boolean isExported(@NotNull PsiJavaModule from, @NotNull PsiJavaModule to) {
    VirtualFile toFile = getVirtualFile(to);
    if (toFile == null) return false;

    Module fromModule = ModuleUtilCore.findModuleForPsiElement(from);
    if (fromModule == null) return false;

    Set<OrderEntry> toEntries = new HashSet<>(ProjectFileIndex.getInstance(from.getProject())
                                                .getOrderEntriesForFile(toFile));
    if (toEntries.isEmpty()) return false;

    OrderEntry[] entries = ModuleRootManager.getInstance(fromModule).getOrderEntries();
    for (OrderEntry entry : entries) {
      if (toEntries.contains(entry) && entry instanceof ExportableOrderEntry exportable) {
        return exportable.isExported();
      }
    }
    return false;
  }
private static boolean isExported(@NotNull PsiJavaModule from, @NotNull PsiJavaModule to)