Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1298

Fix QName.compareTo() logic

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 8.0.0
    • None
    • None

      QName implements Comparable<QName> contract with the following logic:

          public int compareTo(final QName o) {
              int result = getLocalName().compareTo(o.getLocalName());
              if (result != 0) {
                  return result;
              }
              return module.compareTo(o.module);
          }
      

      this has very ugly implications, as QNames are grouped by their localName first and then by their namespace.

      This is counter-intuitive as namespace is really what is grouping concerns, hence we should keep things in the namespace neatly together.

       

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: