diff --git a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilderResult.java b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilderResult.java index f834577a596c..677c78eab8c4 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilderResult.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilderResult.java @@ -19,9 +19,9 @@ package org.apache.maven.internal.impl.model; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -42,7 +42,7 @@ class DefaultModelBuilderResult implements ModelBuilderResult { private Model effectiveModel; private List activePomProfiles; private List activeExternalProfiles; - private final List problems = new CopyOnWriteArrayList<>(); + private final Queue problems = new ConcurrentLinkedQueue<>(); private final DefaultModelBuilderResult problemHolder; private final List children = new ArrayList<>(); @@ -125,7 +125,7 @@ public void setActiveExternalProfiles(List activeProfiles) { */ @Override public List getProblems() { - return Collections.unmodifiableList(problems); + return List.copyOf(problems); } /**