You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/04/12 20:26:00 UTC

[jira] [Resolved] (GROOVY-10971) STC is looking for the wrong constructor reference

     [ https://issues.apache.org/jira/browse/GROOVY-10971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles resolved GROOVY-10971.
----------------------------------
    Resolution: Fixed

https://github.com/apache/groovy/commit/7bcd342a364e09343ef4d6cf5d29255ce737851d

> 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)