Using Greclipse 4.6.0.v202205032224-e2112, with Groovy 2.5 compiler (2.5.16 on build path).
Consider these Java classes/interfaces:
package testgen;
public interface MyInterface {
}
package testgen;
public class MyClass<T> {
}
package testgen;
import java.util.List;
public class MyClassE<T extends MyInterface> extends MyClass<T> {
MyClassE(){}
MyClassE(List<T> list) {
}
}
And these Groovy classes:
package testgen
class MyBean implements MyInterface {
}
and:
package testgen
import groovy.transform.CompileStatic
@CompileStatic
class GClass {
MyClassE<MyBean> foo
void bar() {
foo = new MyClassE<>(new ArrayList<>())
}
}
The assignment is marked with an error in Greclipse:
Groovy:[Static type checking] - Incompatible generic argument types. Cannot assign testgen.MyClassE<testgen.
MyInterface> to: testgen.MyClassE<testgen.MyBean>
This error is not given when compiling with Gradle/groovyc.
Also, if I replace that assignment with:
no error is given by Greclipse as well. So it seems like the combination with the list is fooling Greclipse.
Workaround:
foo = new MyClassE<MyBean>(new ArrayList<>())
Using Greclipse 4.6.0.v202205032224-e2112, with Groovy 2.5 compiler (2.5.16 on build path).
Consider these Java classes/interfaces:
And these Groovy classes:
and:
The assignment is marked with an error in Greclipse:
This error is not given when compiling with Gradle/groovyc.
Also, if I replace that assignment with:
no error is given by Greclipse as well. So it seems like the combination with the list is fooling Greclipse.
Workaround: