[
https://issues.apache.org/jira/browse/GROOVY-10316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-10316:
---------------------------------
Fix Version/s: 2.5.18
> Type variable inference does not work properly in nested diamond operators
> --------------------------------------------------------------------------
>
> Key: GROOVY-10316
> URL: https://issues.apache.org/jira/browse/GROOVY-10316
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 3.0.11
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-1, 4.0.3, 2.5.18, 3.0.12
>
>
> I have the following program
> {code:java}
> class A<T> {
> T f;
> A(T f) {
> this.f = f;
> }
> }
> class B<T> {
> A<T> f;
> B(A<T> f) {
> this.f = f;
> }
> }
> class Test {
> void test() {
> def x = new B<>(new A<>((long) 1)).f;
> A<Long> y = x;
> }
>
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 18: [Static type checking] - Incompatible generic argument
> types. Cannot assign A<java.lang.Object> to: A<java.lang.Long>
> @ line 18, column 17.
> A<Long> y = x;
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master
--
This message was sent by Atlassian Jira
(v8.20.10#820010)