private static @NotNull Collection<Import> collectNamesToImport(@NotNull PsiJavaFile file, @NotNull List<? super PsiElement> comments){
    Set<Import> imports = new HashSet<>();

    JspFile jspFile = JspPsiUtil.getJspFile(file);
    collectNamesToImport(imports, comments, file, jspFile);
    if (jspFile != null) {
      PsiFile[] files = ArrayUtil.mergeArrays(JspSpiUtil.getIncludingFiles(jspFile), JspSpiUtil.getIncludedFiles(jspFile));
      for (PsiFile includingFile : files) {
        PsiFile javaRoot = includingFile.getViewProvider().getPsi(JavaLanguage.INSTANCE);
        if (javaRoot instanceof PsiJavaFile psiJavaFile && file != javaRoot) {
          collectNamesToImport(imports, comments, psiJavaFile, jspFile);
        }
      }
    }

    addUnresolvedImportNames(imports, file);

    return imports;
  }
private static @NotNull Collection<Import> collectNamesToImport(@NotNull PsiJavaFile file, @NotNull List<? super PsiElement> comments)