You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Robert Clark (JIRA)" <ji...@apache.org> on 2012/10/17 17:32:03 UTC

[jira] [Updated] (IVY-1354) Dynamic version resolution incorrect under JDK7

     [ https://issues.apache.org/jira/browse/IVY-1354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Clark updated IVY-1354:
------------------------------

    Attachment: latest-revsion-strategy.patch

I've whipped up a small patch that alleviates the problem for my specific use case. The patch also adds the unit test method in the description.
                
> Dynamic version resolution incorrect under JDK7
> -----------------------------------------------
>
>                 Key: IVY-1354
>                 URL: https://issues.apache.org/jira/browse/IVY-1354
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.2.0
>            Reporter: Matt Plaumann
>         Attachments: latest-revsion-strategy.patch
>
>
> JDK7 has re-implemented {{Collections.sort()}}.  This change is causing dynamic revisions to sort incorrectly.
> Here is a simple unit test for {{LatestRevisionStrategyTest}} that shows the behaviour:
> {noformat}
> /**
>  * The sort algorithm in JDK7 changed in a way that requires comparators to be a little
>  * stricter.  Running JDK7 with {@code java.util.Arrays.useLegacyMergeSort=true} reverts
>  * to the previous behaviour.
>  * 
>  * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6804124">RFE: 6804124</a>
>  */
> public void testJdk7Sort() {
>     ArtifactInfo[] revs = toMockAI(new String[]{"latest.integration", "latest.milestone" });
>     	
>     LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy();
>     List sorted = latestRevisionStrategy.sort( revs );
>     	
>     assertEquals(Arrays.asList(revs[1], revs[0]), sorted );
> }
> {noformat}
> The {{-Djava.util.Arrays.useLegacyMergeSort=true}} VM switch reverts to the previous sort algorithm.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira