docs: @Override
      public void writeXML(@WillClose XMLOutput xmlOutput) throws IOException {
          assert project != null;
          try {
              writePrologue(xmlOutput);
              if (withMessages) {
                  computeBugHashes();
                  getProjectStats().computeFileStats(this);
                  String commonBase = null;
                  for (String s : project.getSourceDirList()) {
                      if (commonBase == null) {
                          commonBase = s;
                      } else {
                          commonBase = commonBase.substring(0, commonPrefix(commonBase, s));
                      }
  
                  }
                  if (commonBase != null && commonBase.length() > 0) {
                      if (commonBase.indexOf("/./") > 0) {
                          commonBase = commonBase.substring(0, commonBase.indexOf("/."));
                      }
                      File base = new File(commonBase);
                      if (base.exists() && base.isDirectory() && base.canRead()) {
                          SourceLineAnnotation.generateRelativeSource(base, project);
                      }
                  }
              }
              if (earlyStats && !minimalXML) {
                  getProjectStats().writeXML(xmlOutput, withMessages);
              }
  
              // Write BugInstances
              for (BugInstance bugInstance : getCollection()) {
                  if (!applySuppressions || !project.getSuppressionFilter().match(bugInstance)) {
                      bugInstance.writeXML(xmlOutput, this, withMessages);
                  }
              }
  
              writeEpilogue(xmlOutput);
  
          } finally {
              xmlOutput.finish();
              SourceLineAnnotation.clearGenerateRelativeSource();
          }
      }