private static void collectNamesToImport(@NotNull Set<? super Import> imports,
                                           @NotNull List<? super PsiElement> comments,
                                           @NotNull PsiJavaFile file,
                                           @Nullable PsiFile context) {
    String packageName = file.getPackageName();

    List<PsiFile> roots = file.getViewProvider().getAllFiles();
    for (PsiElement root : roots) {
      addNamesToImport(imports, comments, root, packageName, context);
    }
  }
private static void collectNamesToImport(@NotNull Set<? super Import> imports,
                                           @NotNull List<? super PsiElement> comments,
                                           @NotNull PsiJavaFile file,
                                           @Nullable PsiFile context)