EDIT: This is not a problem at all with the code, but with an error in the Groovy Eclipse plugin ( http://jira.codehaus.org/browse/GRECLIPSE-373 )
Eclipse gives me a weird error message about ambiguous types in a Java program, and I really don't understand why. I have an interface that takes a generic parameter indicating what type of data it returns.
public interface InterfaceA<T> {
T getData();
}
One of the implementations looks like this:
public class Impl<T extends AnotherClass> implements InterfaceA<Collection<T>> {
public Collection<T> getData() {
}
}
There is also a container for the interface
public class Container<T extends InterfaceA>
{
private T a;
public Container(T a) {
this.a = a;
}
public T getA() {
return a;
}
}
This leads to the error "getData is ambiguous."
Container<Impl<AnotherClass>> c = new Container(new Impl<AnotherClass>());
Collection<AnotherClass> coll = c.getA().getData();
I'm at a standstill on this.
source
share