[ https://issues.apache.org/jira/browse/MNG-7559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17649887#comment-17649887 ]
ASF GitHub Bot commented on MNG-7559: ------------------------------------- sultan commented on PR #929: URL: https://github.com/apache/maven/pull/929#issuecomment-1359689621 > I must honestly admit that I feel a lot of pain in my ass with this class because: > > * There are too many implications > * No explicit ordering > * No explicit statement/code what is _before_ GA and _after_. > > Edge case: `1.0-a` (alpha) < `1.0` < `1.0-abc` since the qualifier `abc` is not an alpha. > > I think this needs to be split up again. Let's first focus on the `.` (dot) and `-` (hyphen) issue. From my PoV the PR addresses several issues which does not feel right. this can be split into two PRs if needed. the ordering is dispatched into specific locations: * private static final List<String> QUALIFIERS = Arrays.asList("snapshot", "", "sp"); * public static String comparableQualifier(String qualifier) * public static int compareQualifiers(String qualifier1, String qualifier2) but the very fact its separated so far from each other might suggest a different approach > ComparableVersion vs versions with custom qualifiers > ---------------------------------------------------- > > Key: MNG-7559 > URL: https://issues.apache.org/jira/browse/MNG-7559 > Project: Maven > Issue Type: Bug > Affects Versions: 3.8.3 > Reporter: Andrzej Jarmoniuk > Assignee: Michael Osipov > Priority: Major > Fix For: 3.8.x-candidate, 3.9.0, 4.0.0, 4.0.0-alpha-3, > 4.0.0-alpha-4 > > Attachments: image-2022-10-22-18-22-11-591.png > > > Since I know that ComparableVersion was brought to Maven from > versions-maven-plugin, it turns out the bug described here: > https://github.com/mojohaus/versions-maven-plugin/issues/744 > also exists in maven, at least in 3.8.3. > According to the maven version spec, versions containing a qualifier should > be treated as less major than the same versions without the qualifier. > Currently it's only the case for a few "standard" qualifiers, e.g. "-rc*", > "-alpha", etc. > However, it looks like "2.3-pfd" is deemed less major than "2.3". > {code:java} > @Test > public void testComparableVersionWithCustomQualifier() > { > assertThat( new ComparableVersion( "2.3" ).compareTo( new > ComparableVersion( "2.3-pfd" ) ), > greaterThan( 0 ) ); > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)