This discussion is archived
2 Replies Latest reply: Mar 3, 2010 3:37 AM by 800268 RSS

how to inherit generic constructor

843793 Newbie
Currently Being Moderated
I have a super class with below generic constructor:
public class Super {
     public Super(){}
     public <T extends Collection<?>> Super( T sub){
          // Do something
     }
}
I hope all the sub classes of Super will inherit this constructor and will accept a collection of its sub classes, so I have:
public class Sub extends Super {
}
but when initiating the Sub class with a List<Sub>:
List<Sub> x = null;
Sub sub = new Sub(x);
I met compiler error: the constructor Sub(List<Sub>) is undefined.