elharo commented on code in PR #1220:
URL: https://github.com/apache/maven/pull/1220#discussion_r1313207880


##########
maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java:
##########
@@ -301,20 +305,22 @@ private void callDelegates(
     }
 
     private Set<String> populateRealm(ClassRealm classRealm, 
List<ClassRealmConstituent> constituents) {
-        Set<String> includedIds = new LinkedHashSet<>();
+        Set<String> includedIds = Collections.emptySet();

Review Comment:
   You're saying that at this commit, mixing mutable and immutable lists is not 
a problem. That's likely true. However there's no guarantee this will still be 
true in a commit 5 years down the road. I've seen slipping an immutable list 
into something that wasn't expecting it cause very painful production problems. 
It's just safer to always use one or the other, and make sure the declared 
types make it clear which is being used. Any collection not explicitly declared 
as immutable should not be immutable. Yes, this is a design flaw in the Java 
Collections API going back to Java 1.1, but it's a design flaw we have to live 
with.



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