Pankraz76 commented on code in PR #2219: URL: https://github.com/apache/maven/pull/2219#discussion_r2094518296
########## impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolverResult.java: ########## @@ -102,19 +102,27 @@ public class DefaultDependencyResolverResult implements DependencyResolverResult * to {@link #addDependency(Node, Dependency, Predicate, Path)}. * * @param request the corresponding request - * @param cache cache of module information about each dependency * @param exceptions the exceptions that occurred while building the dependency graph * @param root the root node of the dependency graph * @param count estimated number of dependencies */ public DefaultDependencyResolverResult( + DependencyResolverRequest request, List<Exception> exceptions, Node root, int count) { + this(request, new PathModularizationCache(), exceptions, root, count); + } + + DefaultDependencyResolverResult( DependencyResolverRequest request, PathModularizationCache cache, List<Exception> exceptions, Node root, int count) { this.request = request; - this.cache = cache; + if (cache == null) { Review Comment: ```suggestion if (cache != null) { ``` ########## impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolverResult.java: ########## @@ -102,19 +102,27 @@ public class DefaultDependencyResolverResult implements DependencyResolverResult * to {@link #addDependency(Node, Dependency, Predicate, Path)}. * * @param request the corresponding request - * @param cache cache of module information about each dependency * @param exceptions the exceptions that occurred while building the dependency graph * @param root the root node of the dependency graph * @param count estimated number of dependencies */ public DefaultDependencyResolverResult( + DependencyResolverRequest request, List<Exception> exceptions, Node root, int count) { + this(request, new PathModularizationCache(), exceptions, root, count); + } + + DefaultDependencyResolverResult( DependencyResolverRequest request, PathModularizationCache cache, List<Exception> exceptions, Node root, int count) { this.request = request; - this.cache = cache; + if (cache == null) { + this.cache = new PathModularizationCache(); + } else { + this.cache = cache; + } Review Comment: ```suggestion } ``` one concern. ########## impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolverResult.java: ########## @@ -102,19 +102,27 @@ public class DefaultDependencyResolverResult implements DependencyResolverResult * to {@link #addDependency(Node, Dependency, Predicate, Path)}. * * @param request the corresponding request - * @param cache cache of module information about each dependency * @param exceptions the exceptions that occurred while building the dependency graph * @param root the root node of the dependency graph * @param count estimated number of dependencies */ public DefaultDependencyResolverResult( + DependencyResolverRequest request, List<Exception> exceptions, Node root, int count) { + this(request, new PathModularizationCache(), exceptions, root, count); + } + + DefaultDependencyResolverResult( DependencyResolverRequest request, PathModularizationCache cache, List<Exception> exceptions, Node root, int count) { this.request = request; - this.cache = cache; + if (cache == null) { + this.cache = new PathModularizationCache(); Review Comment: ```suggestion this.cache = cache; ``` might consider init on declaration to give cohesion; default - making first things first. ########## impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolverResult.java: ########## @@ -102,19 +102,27 @@ public class DefaultDependencyResolverResult implements DependencyResolverResult * to {@link #addDependency(Node, Dependency, Predicate, Path)}. * * @param request the corresponding request - * @param cache cache of module information about each dependency Review Comment: `private final PathModularizationCache cache = new PathModularizationCache();` L:98 - https://www.reddit.com/r/learnjava/comments/ozgtxm/is_initializing_variables_at_their_declaration/ - https://softwareengineering.stackexchange.com/questions/379039/what-is-the-best-practice-for-initializing-variables-outside-or-inside-of-the-c - -- 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