EDIT: This turned out not be a problem with the code at all, but with a bug in the Groovy Eclipse plugin (http://jira.codehaus.org/browse/GRECLIPSE-373)
Eclipse is giving 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 of it looks like this:
public class Impl<T extends AnotherClass> implements InterfaceA<Collection<T>> {
public Collection<T> getData() {
// get the data
}
}
There is also a container for an InterfaceA
public class Container<T extends InterfaceA>
{
private T a;
public Container(T a) {
this.a = a;
}
public T getA() {
return a;
}
}
Doing this causes the "getData is ambiguous" error.
Container<Impl<AnotherClass>> c = new Container(new Impl<AnotherClass>());
Collection<AnotherClass> coll = c.getA().getData();
I'm stumped on this one.