code: @GwtIncompatible("Unnecessary")
    public static ImmutableList<JSError> removeDuplicateZipEntries(
        List<SourceFile> sourceFiles, List<JsModuleSpec> jsModuleSpecs) throws IOException {
      ImmutableList.Builder<JSError> errors = ImmutableList.builder();
      Map<String, SourceFile> sourceFilesByName = new HashMap<>();
      Iterator<SourceFile> fileIterator = sourceFiles.iterator();
      int currentFileIndex = 0;
      Iterator<JsModuleSpec> moduleIterator = jsModuleSpecs.iterator();
      // Tracks the total number of js files for current module and all the previous modules.
      int cumulatedJsFileNum = 0;
      JsModuleSpec currentModule = null;
      while (fileIterator.hasNext()) {
        SourceFile sourceFile = fileIterator.next();
        currentFileIndex++;
        // Check whether we reached the next module.
        if (moduleIterator.hasNext() && currentFileIndex > cumulatedJsFileNum) {
          currentModule = moduleIterator.next();
          cumulatedJsFileNum += currentModule.numJsFiles;
        }
        String fullPath = sourceFile.getName();
        if (!fullPath.contains("!/")) {
          // Not a zip file
          continue;
        }
        String relativePath = fullPath.split("!")[1];
        if (!sourceFilesByName.containsKey(relativePath)) {
          sourceFilesByName.put(relativePath, sourceFile);
        } else {
          SourceFile firstSourceFile = sourceFilesByName.get(relativePath);
          if (firstSourceFile.getCode().equals(sourceFile.getCode())) {
            fileIterator.remove();
            if (currentModule != null) {
              currentModule.numJsFiles--;
            }
          } else {
            errors.add(
                JSError.make(
                    CONFLICTING_DUPLICATE_ZIP_CONTENTS,
                    firstSourceFile.getName(),
                    sourceFile.getName()));
          }
        }
      }
      return errors.build();
    }
docs: Check that relative paths inside zip files are unique, since multiple files with the same path
  inside different zips are considered duplicate inputs. Parameter {@code sourceFiles} may be
  modified if duplicates are removed.