You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Hudson (Jira)" <ji...@apache.org> on 2020/03/28 15:03:03 UTC

[jira] [Commented] (MNG-6164) Collections inconsistently immutable

    [ https://issues.apache.org/jira/browse/MNG-6164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17069783#comment-17069783 ] 

Hudson commented on MNG-6164:
-----------------------------

Build failed in Jenkins: Maven TLP » maven-studies » maven-metrics #4

See https://builds.apache.org/job/maven-box/job/maven-studies/job/maven-metrics/4/

> 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
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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
(v8.3.4#803005)