You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2024/10/19 07:46:37 UTC
[PR] [MNG-8331] Fix disappearing dependencies [maven]
gnodet opened a new pull request, #1822:
URL: https://github.com/apache/maven/pull/1822
(no comment)
--
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
Re: [PR] [MNG-8331] Fix disappearing dependencies [maven]
Posted by "mthmulders (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-8331] Fix disappearing dependencies [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #1822:
URL: https://github.com/apache/maven/pull/1822#issuecomment-2424067815
Let's go with #1821
--
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
Re: [PR] [MNG-8331] Fix disappearing dependencies [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet closed pull request #1822: [MNG-8331] Fix disappearing dependencies
URL: https://github.com/apache/maven/pull/1822
--
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
Re: [PR] [MNG-8331] Fix disappearing dependencies [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #1822:
URL: https://github.com/apache/maven/pull/1822#discussion_r1807254941
##########
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:
The point is to not recreate a new `Model` object is there's no need to. We could go further and delay the creation of the list until it's actually needed, but that would mean store the index, etc... I think the code was less readable.
--
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
Re: [PR] [MNG-8331] Fix disappearing dependencies [maven]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #1822:
URL: https://github.com/apache/maven/pull/1822#issuecomment-2423691520
Another alternative mixing the two solutions: https://github.com/apache/maven/pull/1823
--
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