public int compareTo()

in maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/DefaultVersionInfo.java [226:249]


    public int compareTo(VersionInfo obj) {
        DefaultVersionInfo that = (DefaultVersionInfo) obj;

        int result;
        // TODO: this is a workaround for a bug in DefaultArtifactVersion - fix there - 1.01 < 1.01.01
        if (strVersion.startsWith(that.strVersion)
                && !strVersion.equals(that.strVersion)
                && strVersion.charAt(that.strVersion.length()) != '-') {
            result = 1;
        } else if (that.strVersion.startsWith(strVersion)
                && !strVersion.equals(that.strVersion)
                && that.strVersion.charAt(strVersion.length()) != '-') {
            result = -1;
        } else {
            // TODO: this is a workaround for a bug in DefaultArtifactVersion - fix there - it should not consider case
            // in comparing the qualifier
            // NOTE: The combination of upper-casing and lower-casing is an approximation of String.equalsIgnoreCase()
            String thisVersion = strVersion.toUpperCase(Locale.ENGLISH).toLowerCase(Locale.ENGLISH);
            String thatVersion = that.strVersion.toUpperCase(Locale.ENGLISH).toLowerCase(Locale.ENGLISH);

            result = new DefaultArtifactVersion(thisVersion).compareTo(new DefaultArtifactVersion(thatVersion));
        }
        return result;
    }