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/08/25 16:47:00 UTC
[jira] [Assigned] (GROOVY-10975) STC rejects program when passing method reference in parameterized function
[ https://issues.apache.org/jira/browse/GROOVY-10975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10975:
------------------------------------
Assignee: Eric Milles
> STC rejects program when passing method reference in parameterized function
> ---------------------------------------------------------------------------
>
> Key: GROOVY-10975
> URL: https://issues.apache.org/jira/browse/GROOVY-10975
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Minor
>
> Probably a regression because groovyc 4.0.10 compiles the program.
> Program:
> {code}
> import java.util.*;
> class Main {
> static final void test() {
> Collection<Integer> x = null;
> WeakHashMap<Integer, Integer> y = null;
> new Hashtable<java.lang.IllegalStateException, Boolean>(Collections.min(x, y::put));
> }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Main.groovy: 8: [Static type checking] - Cannot find matching constructor java.util.Hashtable(java.lang.Object)
> @ line 8, column 5.
> new Hashtable<java.lang.IllegalStateException, Boolean>(Collections.min(x, y::put));
> ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: d3c914693486bf137ec0992ef0dc28b79cba2fae)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)