private static PsiFile[] filesToAnnotate(@NotNull Collection<PsiElement> elements) {
    Set<PsiFile> files = new HashSet<>();
    for (PsiElement element : elements) {
      PsiFile psiFile = fileToAnnotate(element);
      if (psiFile != null) {
        files.add(psiFile);
      }
    }
    return files.toArray(PsiFile.EMPTY_ARRAY);
  }
private static PsiFile[] filesToAnnotate(@NotNull Collection<PsiElement> elements)