[
https://issues.apache.org/jira/browse/GROOVY-11074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Sun resolved GROOVY-11074.
---------------------------------
Resolution: Fixed
> Imprecise type for parameterized method when involving subtyping
> ----------------------------------------------------------------
>
> Key: GROOVY-11074
> URL: https://issues.apache.org/jira/browse/GROOVY-11074
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Daniel Sun
> Priority: Minor
> Fix For: 7.0.0-alpha-1
>
>
> I have the following code
> {code}
> class Main {
> static final void test() {
> Number x = 1;
> List<Number> y = m(x, 1);
>
> }
> static <T> List<T> m(T x, T y) { return null; }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 4: [Static type checking] - Incompatible generic argument types.
> Cannot assign java.util.List<? extends java.lang.Number> to:
> java.util.List<java.lang.Number>
> @ line 4, column 22.
> List<Number> y = m(x, 1);
> ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: 73c0f12ab35427bc3e7fd76929b482df61e1b80d)
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)