[
https://issues.apache.org/jira/browse/GROOVY-10971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-10971:
------------------------------------
Assignee: Eric Milles
> STC is looking for the wrong constructor reference
> --------------------------------------------------
>
> Key: GROOVY-10971
> URL: https://issues.apache.org/jira/browse/GROOVY-10971
> Project: Groovy
> Issue Type: Bug
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
>
> I have the following program
> {code}
> 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; }
> }
> {code}
> h3. Actual behavior
> {code}
> 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
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: 46722e7147ed529fe8817660617ac6af98ad6f54)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)