Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
I have the following program
import java.util.function.Supplier interface A { Double m() } interface B extends A { } class C implements B { Integer m() { 42 } } @groovy.transform.CompileStatic class Test { B f = new C() public void test() { Supplier<Integer> s = f::m assert s.get() == 42 } }
Actual behavior
The code is rejected with
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 17: Failed to find method 'm()' for the type: B @ line 17, column 26. Supplier<Double> x = f::m; ^1 error
Expected behavior
The code should have been compiled successfully.
Notes
There are two requirements for this bug:
- The type of the receiver should be an interface (e.g., B) that extends the interface where the method is defined.
- The receiver should be a field.