mthmulders commented on code in PR #1822:
URL: https://github.com/apache/maven/pull/1822#discussion_r1807238719


##########
maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilder.java:
##########
@@ -595,6 +595,8 @@ Model transformFileToRaw(Model model) {
                     } else {
                         newDeps.add(dep);
                     }
+                } else {
+                    newDeps.add(dep);

Review Comment:
   Because of this, the size of `newDeps` will always be equal to the number of 
objects in `model.getDependencies()`. We might as well pre-allocate the 
`ArrayList` with the correct size, so we avoid resizing `newDeps` while looping 
through `model.getDependencies()`.



##########
maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilder.java:
##########
@@ -595,6 +595,8 @@ Model transformFileToRaw(Model model) {
                     } else {
                         newDeps.add(dep);
                     }
+                } else {
+                    newDeps.add(dep);
                 }
             }
             return modified ? model.withDependencies(newDeps) : model;

Review Comment:
   I feel that remembering `modified` no longer makes sense and obfuscates what 
this method is doing. What purpose of that variable am I missing?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to