static HighlightInfo.Builder checkFileDuplicates(@NotNull PsiJavaModule element, @NotNull PsiFile file) {
    Project project = file.getProject();
    Module module = ModuleUtilCore.findModuleForFile(file);
    if (module == null) return null;
    Collection<VirtualFile> moduleInfos = FilenameIndex.getVirtualFilesByName(PsiJavaModule.MODULE_INFO_FILE, module.getModuleScope());
    JpsModuleSourceRootType<?> type = ProjectFileIndex.getInstance(project).getContainingSourceRootType(file.getVirtualFile());
    if (type == null || !JavaModuleSourceRootTypes.SOURCES.contains(type)) return null;
    ModuleFileIndex moduleFileIndex = ModuleRootManager.getInstance(module).getFileIndex();
    Collection<VirtualFile> rootModuleInfos = ContainerUtil.filter(moduleInfos, moduleInfo ->
      moduleFileIndex.isUnderSourceRootOfType(moduleInfo, ContainerUtil.newHashSet(type))
    );
    if (rootModuleInfos.size() > 1) {
      String message = JavaErrorBundle.message("module.file.duplicate");
      HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
        .range(range(element))
        .descriptionAndTooltip(message);
      rootModuleInfos.stream().map(f -> PsiManager.getInstance(project).findFile(f)).filter(f -> f != file).findFirst().ifPresent(
        duplicate -> {
          var action = new GoToSymbolFix(duplicate, JavaErrorBundle
            .message("module.open.duplicate.text"));
          info.registerFix(action, null, null, null, null);
        }
      );
      return info;
    }
    return null;
  }
static HighlightInfo.Builder checkFileDuplicates(@NotNull PsiJavaModule element, @NotNull PsiFile file)