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

ASF GitHub Bot commented on GROOVY-11308:
-----------------------------------------

octylFractal opened a new pull request, #2056:
URL: https://github.com/apache/groovy/pull/2056

   The documentation for this method states that when `mutate` is false, a new 
collection is _always_ returned. The previous code only did so when 
`self.size()` was greater than 1, and otherwise returned null.




> DefaultGroovyMethods#unique now returns null for empty or 1 element input
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-11308
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11308
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 3.0.21, 4.0.19, 5.0.0-alpha-6
>            Reporter: Octavia Togami
>            Priority: Critical
>
> https://github.com/apache/groovy/commit/c181ef72e442f1d51855e0db6d44ab302cf7c662
>  changed the behavior of {{DefaultGroovyMethods#unique}} to return {{null}} 
> for an empty or one element collection input when {{mutate}} is {{false}}. 
> This requires a really awkward workaround and breaks compatibility with 
> previous versions, and I personally don't think the behavior makes sense.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to