[ https://issues.apache.org/jira/browse/GROOVY-11618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17943936#comment-17943936 ]
ASF GitHub Bot commented on GROOVY-11618: ----------------------------------------- eric-milles opened a new pull request, #2190: URL: https://github.com/apache/groovy/pull/2190 https://issues.apache.org/jira/browse/GROOVY-11618 https://issues.apache.org/jira/browse/GROOVY-10741 > 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 > > 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)