Thodoris Sotiropoulos created GROOVY-10974:
----------------------------------------------
Summary: Fail to perform SAM conversion using method references
Key: GROOVY-10974
URL: https://issues.apache.org/jira/browse/GROOVY-10974
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following program
{code}
import java.util.*;
import java.util.stream.*;
import java.util.function.*;
class Main {
static final void test(DoubleStream x, ObjDoubleConsumer<Boolean> y,
BiConsumer<Boolean, Boolean> z) {
Spliterator.OfDouble d = null;
StreamSupport.doubleStream(d, x.collect(
() -> true, y::accept, z::accept));
}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 10: [Static type checking] - Cannot find matching method
java.util.stream.StreamSupport#doubleStream(java.util.Spliterator$OfDouble, U).
Please check if the declared type is correct and if the method exists.
@ line 10, column 9.
StreamSupport.doubleStream(d, x.collect(
^
1 error
{code}
h3. Expected behavior
Compile successfully
Tested against master (commit: d3c914693486bf137ec0992ef0dc28b79cba2fae)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)