You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by "Xavier Hanin (JIRA)" <ji...@apache.org> on 2007/03/16 06:59:09 UTC

[jira] Commented: (IVY-435) LatestRevisionStrategy.sort() doesn't sort as specified

    [ https://issues.apache.org/jira/browse/IVY-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481505 ] 

Xavier Hanin commented on IVY-435:
----------------------------------

I think we should modify the javadoc, because otherwise it would break a lot of code depending on the actual implementation, and not on the javadoc :-)

> LatestRevisionStrategy.sort() doesn't sort as specified
> -------------------------------------------------------
>
>                 Key: IVY-435
>                 URL: https://issues.apache.org/jira/browse/IVY-435
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>            Reporter: Maarten Coene
>
> According to the LatestStrategy.sort() javadoc, the sort method should sort the artifacts from latest to oldest.
> However, the LatestRevisionStrategy.sort() method does the opposite!
> The following junit test shows this (add to LatestRevisionStrategyTest.java):
> {code}
>     public void testSort() {
>         ArtifactInfo[] revs = toMockAI(new String[] {
>                 "0.2a", 
>                 "0.2_b", 
>                 "0.2rc1", 
>                 "0.2-final", 
>                 "1.0-dev1", 
>                 "1.0-dev2", 
>                 "1.0-alpha1", 
>                 "1.0-alpha2", 
>                 "1.0-beta1", 
>                 "1.0-beta2", 
>                 "1.0-gamma",
>                 "1.0-rc1",
>                 "1.0-rc2",
>                 "1.0", 
>                 "1.0.1", 
>                 "2.0" 
>                 });
>         
>         List shuffled = new ArrayList(Arrays.asList(revs)); 
>         ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled.toArray(new ArtifactInfo[revs.length]);
>         
>         LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy();
>         List sorted = latestRevisionStrategy.sort(shuffledRevs);
>     	assertEquals(Arrays.asList(revs), sorted);
>     }
> {code}
> The question is: should we change the javadoc or the LatestRevisionStrategy.sort method?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.