public static @Nullable List<String> findUrlForVirtualFile(Project project, VirtualFile virtualFile, String relPath) {
    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();

    Module module = fileIndex.getModuleForFile(virtualFile);
    if (module == null) {
      VirtualFileSystem fs = virtualFile.getFileSystem();
      if (fs instanceof JarFileSystem) {
        VirtualFile jar = ((JarFileSystem)fs).getLocalByEntry(virtualFile);
        if (jar != null) {
          module = fileIndex.getModuleForFile(jar);
        }
      }
    }
    if (module != null) {
      String[] extPaths = JavaModuleExternalPaths.getInstance(module).getJavadocUrls();
      List<String> httpRoots = PlatformDocumentationUtil.getHttpRoots(extPaths, relPath);
      // if found nothing and the file is from library classes, fall back to order entries
      if (httpRoots != null || !fileIndex.isInLibraryClasses(virtualFile)) {
        return httpRoots;
      }
    }

    PsiJavaModule javaModule = JavaModuleGraphUtil.findDescriptorByFile(virtualFile, project);
    String altRelPath = javaModule != null ? javaModule.getName() + '/' + relPath : null;

    for (OrderEntry orderEntry : fileIndex.getOrderEntriesForFile(virtualFile)) {
      boolean altUrl =
        orderEntry instanceof JdkOrderEntry && JavaSdkVersionUtil.isAtLeast(((JdkOrderEntry)orderEntry).getJdk(), JavaSdkVersion.JDK_11);

      for (VirtualFile root : orderEntry.getFiles(JavadocOrderRootType.getInstance())) {
        if (root.getFileSystem() == JarFileSystem.getInstance()) {
          VirtualFile file = root.findFileByRelativePath(relPath);
          if (file == null && altRelPath != null) file = root.findFileByRelativePath(altRelPath);
          if (file != null) {
            List<Url> urls = BuiltInWebBrowserUrlProviderKt.getBuiltInServerUrls(file, project, null);
            if (!urls.isEmpty()) {
              return ContainerUtil.map(urls, Url::toExternalForm);
            }
          }
        }
      }

      String[] webUrls = JavadocOrderRootType.getUrls(orderEntry);
      if (webUrls.length > 0) {
        List<String> httpRoots = new ArrayList<>();
        if (altUrl && altRelPath != null) {
          httpRoots.addAll(notNull(PlatformDocumentationUtil.getHttpRoots(webUrls, altRelPath), Collections.emptyList()));
        }
        httpRoots.addAll(notNull(PlatformDocumentationUtil.getHttpRoots(webUrls, relPath), Collections.emptyList()));
        if (!httpRoots.isEmpty()) {
          return httpRoots;
        }
      }
    }

    return null;
  }
public static @Nullable List<String> findUrlForVirtualFile(Project project, VirtualFile virtualFile, String relPath)