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

Eric Milles commented on GROOVY-11618:
--------------------------------------

The PR was for Groovy 4. So you can test with latest 4 snapshot. 

> Method reference not found for record fields
> --------------------------------------------
>
>                 Key: GROOVY-11618
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11618
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static compilation
>    Affects Versions: 4.0.24
>            Reporter: Saravanan
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.27
>
>
> Stream operations that use method references do not compile for record 
> fields. The following code results in
> {noformat}
> Failed to find class method 'blah(com.Records.RecordTesting$MyRecord)' 
> or instance method 'blah()' for the type: com.Records.RecordTesting$MyRecord 
>  
> {noformat}
>  
>  
> {code:java}
> package com.Records;
> import java.util.Arrays;
> import java.util.stream.Collectors;
> public class RecordTesting {
>     public record MyRecord(String blah) {}
>     public String create() {
>         var myList = Arrays.asList(new MyRecord("blah"));
>         // This line fails with 
>         // Failed to find class method
>         // 'blah(com.Records.RecordTesting$MyRecord)' or instance 
>         // method 'blah()' for the type: com.Records.RecordTesting$MyRecord 
>         var myData = myList.stream().map(MyRecord::blah);
>         return myData.collect(Collectors.joining());
>     }
> }{code}
>  



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

Reply via email to