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


##########
impl/maven-core/src/main/java/org/apache/maven/project/MavenProject.java:
##########
@@ -876,15 +877,11 @@ public void setArtifacts(Set<Artifact> artifacts) {
      * @see #getDependencyArtifacts() to get only direct dependencies
      */
     public Set<Artifact> getArtifacts() {
-        if (artifacts == null) {
-            if (artifactFilter == null || resolvedArtifacts == null) {
-                artifacts = new LinkedHashSet<>();
-            } else {
-                artifacts = new LinkedHashSet<>(resolvedArtifacts.size() * 2);
-                for (Artifact artifact : resolvedArtifacts) {
-                    if (artifactFilter.include(artifact)) {
-                        artifacts.add(artifact);
-                    }
+        if (artifactFilter != null && resolvedArtifacts != null) {

Review Comment:
   this method was quite tested. Both fields are used to avoiding NPE seems the 
thing to do. will update.



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