you need to specify your parent class generics
public class B<T1,T2,T3> extends A<T1,T2> {
Question
I have a class A and a class B which extends A
public class A<T1, T2> {
private T1 x;
private T2 y;
public A(T1 x, T2 y) {
this.x = x;
this.y = y;
}
}
The above code works fine, now for class B
public class B<T1,T2,T3> extends A {
private T3 z;
public Triplet(T1 x, T2 y, T3 z) {
super(x, y);
this.z = z;
}
}
Eclipse gives the following warning on this code:
Type safety: The constructor A(Object, Object) belongs to the raw type A. References to generic type A should be parameterized
What does this mean, is my super call incorrect or something else?
Solution
you need to specify your parent class generics
public class B<T1,T2,T3> extends A<T1,T2> {