def METHOD_NAME(xml):
  """Turns a JaCoCo XML report into an llvm-cov JSON summary."""
  summary = {
      'type': 'oss-fuzz.java.coverage.json.export',
      'version': '1.0.0',
      'data': [{
          'totals': {},
          'files': [],
      }],
  }
  report = ET.fromstring(xml)
  totals = make_element_summary(report)
  summary['data'][0]['totals'] = totals
  # Since Java compilation does not track source file location, we match
  # coverage info to source files via the full class name, e.g. we search for
  # a path in /out/src ending in foo/bar/Baz.java for the class foo.bar.Baz.
  # Under the assumptions that a given project only ever contains a single
  # version of a class and that no class name appears as a suffix of another
  # class name, we can assign coverage info to every source file matched in that
  # way.
  src_files = list_src_files()
  for class_element in report.findall('./package/class'):
    class_name = class_element.attrib['name']
    package_name = os.path.dirname(class_name)
    if 'sourcefilename' not in class_element.attrib:
      continue
    basename = class_element.attrib['sourcefilename']
    # This path is 'foo/Bar.java' for the class element
    # <class name="foo/Bar" sourcefilename="Bar.java">.
    canonical_path = os.path.join(package_name, basename)
    class_summary = make_element_summary(class_element)
    src_files = relative_to_src_path(src_files, canonical_path)
    for src_file in src_files:
      summary['data'][0]['files'].append({
          'filename': src_file,
          'summary': class_summary,
      })
  return json.dumps(summary)