문제

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?

도움이 되었습니까?

해결책

you need to specify your parent class generics

public class B<T1,T2,T3> extends A<T1,T2> {
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top