public static void writeDuplicates(@NotNull Path dir, @NotNull Project project, DupInfo info) throws IOException, XMLStreamException {
    try (BufferedWriter fileWriter = Files.newBufferedWriter(dir.resolve("duplicates.xml"))) {
      XMLStreamWriter writer = XMLOutputFactory.newDefaultFactory().createXMLStreamWriter(fileWriter);
      writer.writeStartElement("root");
      final int patterns = info.getPatterns();
      for (int i = 0; i < patterns; i++) {
        writer.writeStartElement("duplicate");
        writer.writeAttribute("cost", String.valueOf(info.getPatternCost(i)));
        writer.writeAttribute("hash", String.valueOf(info.getHash(i)));
        writeFragments(Arrays.asList(info.getFragmentOccurences(i)), writer, project, true);
        writer.writeEndElement();
      }
      writer.writeEndElement(); //root node
      writer.flush();
    }
  }
public static void writeDuplicates(@NotNull Path dir, @NotNull Project project, DupInfo info)