[
https://issues.apache.org/jira/browse/GROOVY-10813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-10813.
----------------------------------
Resolution: Fixed
https://github.com/apache/groovy/commit/657c8e5395d1343775669a425167c78dcd9ac220
> Cannot create method reference for print or println
> ---------------------------------------------------
>
> Key: GROOVY-10813
> URL: https://issues.apache.org/jira/browse/GROOVY-10813
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 3.0.13, 4.0.6
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Attachments: screenshot-1.png
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> void p() {
> java.util.function.Consumer c = this::print
> c.accept('hello world!')
> }
> p()
> {code}
> Throws error "LambdaConversionException: Type mismatch in captured lambda
> parameter 0: expecting class _script_, found class java.lang.Object"
> I was trying to print a stream element via "this::println". This fails also
> with "System.out::println" as well. I had to use closure syntax which works
> just fine. Lambda throws NPE: "Consumer c = obj -> print(obj)"
--
This message was sent by Atlassian Jira
(v8.20.10#820010)