docs: public static void writeXML(XMLOutput xmlOutput, String elementName, BugAnnotation annotation,
              XMLAttributeList attributeList, boolean addMessages) throws IOException {
  
          SourceLineAnnotation src = null;
          if (annotation instanceof BugAnnotationWithSourceLines) {
              src = ((BugAnnotationWithSourceLines) annotation).getSourceLines();
          }
  
          if (addMessages || src != null) {
              xmlOutput.openTag(elementName, attributeList);
              if (src != null) {
                  src.writeXML(xmlOutput, addMessages, false);
              }
              if (addMessages) {
                  xmlOutput.openTag(BugAnnotation.MESSAGE_TAG);
                  xmlOutput.writeText(annotation.toString());
                  xmlOutput.closeTag(BugAnnotation.MESSAGE_TAG);
              }
              xmlOutput.closeTag(elementName);
          } else {
              xmlOutput.openCloseTag(elementName, attributeList);
          }
  
      }