[ 
https://issues.apache.org/jira/browse/GROOVY-11004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149202#comment-18149202
 ] 

Daniel Sun commented on GROOVY-11004:
-------------------------------------

Fixed on master; added a regression test in 
14208f01dc3a4fa1581f3cf4c6f57f1792316377 
(https://github.com/apache/groovy/commit/14208f01dc3a4fa1581f3cf4c6f57f1792316377).

> Incompatible generic argument types when mixing diamond operator in 
> parameterized function
> ------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11004
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11004
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Daniel Sun
>            Priority: Minor
>             Fix For: 7.0.0-alpha-1
>
>
> This might be a regression, as Groovy 4.0.10 accepts the program.
> I have the following program
> {code}
> import java.util.*;
> class Main {
>   static final void test() {
>     Map<Number, String> x = null;
>     Map<Number, String> y = Collections.unmodifiableNavigableMap(new 
> TreeMap<>(x));
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 6: [Static type checking] - Incompatible generic argument types. 
> Cannot assign java.util.NavigableMap<java.lang.Object, java.lang.Object> to: 
> java.util.Map<java.lang.Number, java.lang.String>
>  @ line 6, column 29.
>        Map<Number, String> y = Collections.unmodifiableNavigableMap(new 
> TreeMap<>(x));
>                                ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to