You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2023/01/19 09:36:13 UTC

[GitHub] [maven] rmannibucau commented on a diff in pull request #913: MNG-7630 - Support listing of workspace models

rmannibucau commented on code in PR #913:
URL: https://github.com/apache/maven/pull/913#discussion_r1081012109


##########
maven-core/src/main/java/org/apache/maven/internal/aether/MavenChainedWorkspaceReader.java:
##########
@@ -60,6 +62,31 @@ public Model findModel(Artifact artifact) {
         return null;
     }
 
+    @Override
+    public Stream<Artifact> listArtifacts() {
+        return Arrays.stream(readers)
+                .flatMap(r -> {
+                    // TODO once resolver 2.x is there this part can be simplified
+                    if (r instanceof MavenWorkspaceReader) {
+                        return ((MavenWorkspaceReader) r).listArtifacts();
+                    }
+                    return Stream.empty();

Review Comment:
   maybe use `filter(it -> instanceof MavenWorkspaceReader).map(MavenWorkspaceReader.class::cast)`, will avoid the debate of `if/else` (readability on the left vs symmetry - no good choice there)



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