Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
I have the following program
class Foo { Foo(String d) {} } class Main { static final void test() { def x = java.util.stream.Collectors.groupingBy(Main::m) // works; def y = java.util.stream.Collectors.groupingBy(Foo::new) // fails; } static Foo m(String x) { return null; } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 8: [Static type checking] - Cannot find matching constructor Foo(java.lang.Object) @ line 8, column 56. .stream.Collectors.groupingBy(Foo::new) ^ 1 error
Expected behavior
Compile successfully
Tested against master (commit: 46722e7147ed529fe8817660617ac6af98ad6f54)
Attachments
Issue Links
- is related to
-
GROOVY-10930 STC accepts program although constructor reference is invalid
- Closed