maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Heinz Marbaise (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (MNG-6164) Collections inconsistently immutable
Date Sun, 18 Feb 2018 10:31:00 GMT

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

Karl Heinz Marbaise edited comment on MNG-6164 at 2/18/18 10:30 AM:
--------------------------------------------------------------------

HiĀ [~michael-o], I just rebased that branch...but of course I can reassign if you don't mind?


was (Author: khmarbaise):
HiĀ Michael, I just rebased that branch...but of course I can reassign if you don't mind?

> 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
(v7.6.3#76005)

Mime
View raw message