private static @NotNull List<FileTargetContext> getSuitableContexts(@NotNull FileReference reference, @Nullable Module module) {
    FileReferenceSet fileReferenceSet = reference.getFileReferenceSet();

    Collection<FileTargetContext> targetContexts = fileReferenceSet.getTargetContexts();

    if (targetContexts.isEmpty()) {
      return emptyList();
    }

    SmartList<FileTargetContext> contexts = new SmartList<>();
    for (FileTargetContext targetContext : targetContexts) {
      PsiFileSystemItem fsContext = targetContext.getFileSystemItem();
      if (module != null) {
        if (module == getModuleForContext(fsContext)) {
          contexts.add(targetContext);
        }
      }
      else {
        contexts.add(targetContext);
      }
    }

    if (contexts.isEmpty() && ApplicationManager.getApplication().isUnitTestMode()) {
      return singletonList(targetContexts.iterator().next());
    }
    return contexts;
  }
private static @NotNull List<FileTargetContext> getSuitableContexts(@NotNull FileReference reference, @Nullable Module module)