[YANGTOOLS-1298] Fix QName.compareTo() logic Created: 16/Jun/21  Updated: 10/Apr/22  Resolved: 31/Aug/21

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: 8.0.0

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.

 


Generated at Wed Feb 07 20:55:45 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.