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



##########
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:
       When `recursive` of original implementation is `false`, the instance of 
this context is not created, so this one is always `true`.




-- 
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-unsubscr...@maven.apache.org

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


Reply via email to