Giovds commented on code in PR #2132:
URL: https://github.com/apache/maven/pull/2132#discussion_r1972478761


##########
impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java:
##########
@@ -165,6 +166,46 @@ public Optional<Project> getParent() {
         return Optional.ofNullable(session.getProject(parent));
     }
 
+    @Override
+    @Nonnull
+    public List<Profile> getProfiles() {
+        return getModel().getProfiles();
+    }
+
+    @Override
+    @Nonnull
+    public List<Profile> getAllProfiles() {
+        List<org.apache.maven.model.Profile> activeProfiles = new 
ArrayList<>();
+        for (MavenProject project = this.project; project != null; project = 
project.getParent()) {
+            activeProfiles.addAll(project.getModel().getProfiles());
+        }
+        return activeProfiles.stream()
+                .map(org.apache.maven.model.Profile::getDelegate)
+                .toList();
+    }

Review Comment:
   ```suggestion
       public List<Profile> getAllProfiles() {
           List<org.apache.maven.model.Profile> profiles = new ArrayList<>();
           for (MavenProject project = this.project; project != null; project = 
project.getParent()) {
               profiles.addAll(project.getModel().getProfiles());
           }
           return profiles.stream()
                   .map(org.apache.maven.model.Profile::getDelegate)
                   .toList();
       }
   ```



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