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

Fix QName.compareTo() logic

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Medium
    • Resolution: Done
    • None
    • 8.0.0
    • None

    Description

      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.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: