You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christian Schulte (JIRA)" <ji...@apache.org> on 2016/12/11 00:12:58 UTC

[jira] [Closed] (MRESOLVER-8) Mode selection (transitive vs. direct) implemented inconsistently in classes 'ScopeDependencySelector' and 'OptionalDependencySelector'.

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

Christian Schulte closed MRESOLVER-8.
-------------------------------------
    Resolution: Fixed

> Mode selection (transitive vs. direct) implemented inconsistently in classes 'ScopeDependencySelector' and 'OptionalDependencySelector'.
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MRESOLVER-8
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-8
>             Project: Maven Resolver
>          Issue Type: Bug
>            Reporter: Christian Schulte
>            Assignee: Christian Schulte
>            Priority: Critical
>             Fix For: Maven Artifact Resolver 1.2.0
>
>
> The classes 'ScopeDependencySelector' and 'OptionalDependencySelector' inconsistently detected the mode of operation (direct or transitive). Whereas the 'ScopeDependencySelector' honours the kind of resolution having been requested (dependency vs. POM), the 'OptionalDependencySelector' does not honour this difference. As both classes implement the 'DependencySelector', they should select the mode of operation (direct vs. transitive) consistently.
> This is what things looked liked before the fix:
> {panel:title=ScopeDependencySelector}
> {code}
> public DependencySelector deriveChildSelector( DependencyCollectionContext context )
> {
>     if ( this.transitive || context.getDependency() == null )
>     {
>         return this;
>     }
>     return new ScopeDependencySelector( true, included, excluded );
> }
> {code}
> {panel}
> {panel:title=OptionalDependencySelector}
> {code}
> public DependencySelector deriveChildSelector( DependencyCollectionContext context )
> {
>     if ( depth >= 2 )
>     {
>         return this;
>     }
>     return new OptionalDependencySelector( depth + 1 );
> }
> {code}
> {panel}
> This is what both classes look like after the fix. No difference in mode selection any more.
> {panel:title=ScopeDependencySelector}
> {code}
> public DependencySelector deriveChildSelector( DependencyCollectionContext context )
> {
>     ScopeDependencySelector child = this;
>     if ( context.getDependency() != null && !child.transitive )
>     {
>         child = new ScopeDependencySelector( true, this.included, this.excluded );
>     }
>     if ( context.getDependency() == null && child.transitive )
>     {
>         child = new ScopeDependencySelector( false, this.included, this.excluded );
>     }
>     return child;
> }
> {code}
> {panel}
> {panel:title=OptionalDependencySelector}
> {code}
> public DependencySelector deriveChildSelector( DependencyCollectionContext context )
> {
>     OptionalDependencySelector child = this;
>     if ( context.getDependency() != null && !child.transitive )
>     {
>         child = new OptionalDependencySelector( true );
>     }
>     if ( context.getDependency() == null && child.transitive )
>     {
>         child = new OptionalDependencySelector( false );
>     }
>     return child;
> }
> {code}
> {panel}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)