You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/01/18 01:53:32 UTC

[GitHub] [maven-resolver] caiwei-ebay commented on a change in pull request #144: Use BFS approach

caiwei-ebay commented on a change in pull request #144:
URL: https://github.com/apache/maven-resolver/pull/144#discussion_r786365067



##########
File path: maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java
##########
@@ -182,6 +187,89 @@ public void putChildren( Object key, List<DependencyNode> children )
         nodes.put( key, children );
     }
 
+    public DependencyNodeTraceContext getTraceContext( DependencyNode node )
+    {
+        return nodeTraceContexts.get( node );
+    }
+
+    public void putTraceContext( DependencyNode node, DependencyNodeTraceContext context )
+    {
+        nodeTraceContexts.put( node, context );
+    }
+
+    public void putParent( DependencyNode node, DependencyNode parent )
+    {
+        nodeParents.put( node, parent );
+    }
+
+
+    /**
+     * Get all parents of current node (including current node) following the top-down sequence (parent -> child)
+     *
+     * @return
+     */
+    public List<DependencyNode> getAllNodes( DependencyNode current )
+    {
+        return getAllNodes( current, true );
+    }
+
+    public List<DependencyNode> getAllNodes( DependencyNode current, boolean reverse )
+    {
+        List<DependencyNode> nodes = new ArrayList<>();
+        nodes.add( current );
+
+        DependencyNode parent = nodeParents.get( current );
+        while ( parent != null )
+        {
+            nodes.add( parent );
+            parent = nodeParents.get( parent );
+        }
+
+        if ( reverse )
+        {
+            Collections.reverse( nodes );
+        }
+        return nodes;
+    }
+
+    /**
+     * Trace the objects required for inheritance
+     */
+    static final class DependencyNodeTraceContext
+    {
+        DependencySelector depSelector;
+        DependencyManager depManager;
+        DependencyTraverser depTraverser;
+        VersionFilter verFilter;
+        List<RemoteRepository> repositories;
+        List<Dependency> dependencies;
+        List<Dependency> managedDependencies;
+        List<DependencyNode> allNodes;
+        boolean isRoot;
+        boolean recursive;
+
+        @SuppressWarnings( "checkstyle:parameternumber" )
+        DependencyNodeTraceContext( DependencySelector depSelector,
+                                    DependencyManager depManager,
+                                    DependencyTraverser depTraverser,
+                                    VersionFilter verFilter,
+                                    List<RemoteRepository> repositories,
+                                    List<Dependency> dependencies,
+                                    List<Dependency> managedDependencies, List<DependencyNode> allNodes,
+                                    boolean recursive )

Review comment:
       recursive was there in the original implementation, is it safe to remove that?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org