Pankraz76 commented on code in PR #2380:
URL: https://github.com/apache/maven/pull/2380#discussion_r2126925145


##########
impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/PomInlinerTransformer.java:
##########
@@ -52,35 +61,79 @@ class PomInlinerTransformer extends TransformerSupport {
         this.interpolator = requireNonNull(interpolator);
     }
 
+    @Override
+    public InstallRequest remapInstallArtifacts(RepositorySystemSession 
session, InstallRequest request) {
+        return request.setArtifacts(replacePom(session, 
request.getArtifacts()));
+    }
+
+    @Override
+    public DeployRequest remapDeployArtifacts(RepositorySystemSession session, 
DeployRequest request) {
+        return request.setArtifacts(replacePom(session, 
request.getArtifacts()));
+    }
+
+    private Collection<Artifact> replacePom(RepositorySystemSession session, 
Collection<Artifact> artifacts) {
+        Set<String> needsInlining = needsInlining(session);
+        if (needsInlining.isEmpty()) {
+            return artifacts;
+        }
+        ArrayList<Artifact> newArtifacts = new ArrayList<>(artifacts.size());
+        for (Artifact artifact : artifacts) {

Review Comment:
   ```suggestion
           return artifacts.map(....)
   ```
   could avoid overhead, use only for body as `map` operation.
   
   Its already very nice functional and compact. Lets complete this intent. 
   
   its just 1 LOC 
   
   `return isEmpty() ? artifacts : artifacts.map(toFoo()) `



-- 
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