[ 
https://issues.apache.org/jira/browse/GROOVY-10859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles resolved GROOVY-10859.
----------------------------------
    Resolution: Fixed

https://github.com/apache/groovy/commit/7ea11bbf2724d8dcdd5f6d4894e0fdae1cb2349e

> Regression in invoking method references to methods from List class when 
> called on empty lists
> ----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10859
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10859
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Marcin Erdmann
>            Assignee: Eric Milles
>            Priority: Major
>
> While migrating from Groovy 3 to Groovy 4 I have uncovered a regression in 
> how method references to methods on {{List}} are invoked when called on empty 
> lists. The following test case passes on Groovy 3:
> {code:java}
>     def "method references from List class are invoked correctly on empty 
> lists"() {
>         given:
>         def streamOfEmptyCollections = [[]].stream()
>         when:
>         def flattened = 
> streamOfEmptyCollections.flatMap(List::stream).toList()
>         then:
>         flattened == []
>     }
> {code}
> But on Groovy 4 it fails with the following error:
> {noformat}
> Condition not satisfied:
> flattened == []
> |         |
> |         false
> [interface java.util.List]
> {noformat}
> I believe that this regression was introduced by [this change to 
> {{groovy.lang.MetaClassImpl.invokeMethodClosure()}}|https://github.com/apache/groovy/commit/22e5f3bb1823041f9b0445d8e1de0c02dfa87fd1#diff-c28986077bdc1a71b46273a2f3596d89d4608fadc5843b56ec0bc25894e19652R1084]
>  which was part of the fix for GROOVY-10057.



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

Reply via email to