[
https://issues.apache.org/jira/browse/GROOVY-11004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-11004:
---------------------------------
Priority: Minor (was: Major)
> 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
> Priority: Minor
>
> 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
(v8.20.10#820010)