Details
-
Bug
-
Status: In Progress
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I have the following program
class Main { static final <V> void test() { V key = null; CharSequence value = null; java.util.Map.of(key, value); // succeeds java.util.Map.of(key, value, key, value); // fails } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Main.groovy: 6: [Static type checking] - Cannot call <K,V> java.util.Map#of(K, V, K, V) with arguments [V, java.lang.CharSequence, V, java.lang.CharSequence] @ line 6, column 5. java.util.Map.of(key, value, key, value); ^ 1 error
Expected behavior
Compile successfully
Notes
Tested against master (commit: 7a4b2679c77aea8cd9dc00fa2d3b71e25e97fbd2)
The bug is triggered when the variable key has type "V".