Interface with generic parameters- can't get it to compile
Posted
by
user997112
on Stack Overflow
See other posts from Stack Overflow
or by user997112
Published on 2012-07-08T15:02:54Z
Indexed on
2012/07/08
15:15 UTC
Read the original article
Hit count: 186
I have an interface like so:
public interface MyInterface<E extends Something1> {
public void meth1(MyClass1<E> x);
}
and I have a subclass whose superclass implements the above interface:
public class MyClass2<E extends Something1> extends Superclass{
public MyClass2(){
}
public void meth1(MyClass1 x) {
// TODO Auto-generated method stub
}
}
superclass:
public abstract class Superclass<E extends Something1> implements MyInterface{
MyClass1<E> x;
protected E y;
public Superclass(){
}
}
the problem is that the parameter for meth1() is supposed to be generic. If I do MyClass1 it doesn't like it and the only way I can get it to compile is by leaving out generic parameters- which feels wrong.
What's going wrong?
© Stack Overflow or respective owner