Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Probably a regression because groovyc 4.0.10 compiles the program.
Program:
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)); } }
Actual behavior
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
Expected behavior
Compile successfully
Tested against master (commit: d3c914693486bf137ec0992ef0dc28b79cba2fae)
Attachments
Issue Links
- relates to
-
GROOVY-11259 STC loses generic information on method references
- Closed
-
GROOVY-10974 Fail to perform SAM conversion using method references
- Closed
-
GROOVY-11201 STC: assign method pointer to SAM-type
- Closed