Thodoris Sotiropoulos created GROOVY-11066:
----------------------------------------------

             Summary: Unable to call parameterized function that contains type 
variables with recursive bounds
                 Key: GROOVY-11066
                 URL: https://issues.apache.org/jira/browse/GROOVY-11066
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program that uses the guava lib.

{code}
class Main {
  static final void test() {
    String arg1 = null;
    Number arg2 = null;
    com.google.common.collect.ImmutableSortedMap.<String, Number>of(arg1, arg2);
  }
}
{code}

h3. Actual behavior

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 8: [Static type checking] - Cannot call <K extends 
java.lang.Comparable<? super K>,V> 
com.google.common.collect.ImmutableSortedMap#of(K, V) with arguments 
[java.lang.String, java.util.List<java.lang.Number>]
 @ line 8, column 5.
       com.google.common.collect.ImmutableSortedMap.<String, 
List<Number>>of(arg1, arg2);
       ^

1 error
{code}

h3. Expected behavior

Compile successfully

h3. Notes

Tested against master (commit: 7a118010591ca469f0394d8d6946b44201d04ebd)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to