[ https://issues.apache.org/jira/browse/MNG-6164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303098#comment-16303098 ]
ASF GitHub Bot commented on MNG-6164: ------------------------------------- GitHub user ChristianSchulte opened a pull request: https://github.com/apache/maven/pull/141 [MNG-6164] Collections inconsistently immutable. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ChristianSchulte/maven MNG-6164 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven/pull/141.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #141 ---- commit d08cb28d5353b1dc71ffd314b23c08a7fefec484 Author: Christian Schulte <schulte@...> Date: 2015-12-14T03:57:47Z [MNG-6164] Collections inconsistently immutable. ---- > Collections inconsistently immutable > ------------------------------------ > > Key: MNG-6164 > URL: https://issues.apache.org/jira/browse/MNG-6164 > Project: Maven > Issue Type: Improvement > Affects Versions: 3.5.0 > Reporter: Christian Schulte > Assignee: Michael Osipov > Priority: Minor > Fix For: 3.6.0-candidate > > > There are plenty of places where empty collections are returned from public > API in methods written like: > {code} > public List<Exception> getExceptions() > { > return exceptions == null ? Collections.<Exception>emptyList() : > exceptions; > } > {code} > The issue with this is that the empty list is immutable but the collection > returned for the nun-null case is not immutable. > All those methods should return a collection with consistent "mutability": > either mutable, either immutable. > Given empty immutable collections do not cause harm until now, switching > consistently to immutable collections is more conservative and should not be > risky -- This message was sent by Atlassian JIRA (v6.4.14#64029)