I have a parent abstract class and child classes which take generics.
public abstract sealed class Parent<T> permits ChildA, ChildB {}
public non-sealed class ChildA<T extends FileTypeA> extends Parent{}
public non-sealed class ChildB<T extends FileTypeB> extends Parent{}
In the parent class, I am getting warnings:
ChildA is a raw type. References to generic type ChildA<T>
should be parameterized
ChildB is a raw type. References to generic type ChildB<T>
should be parameterized
In the child classes, I am getting warnings:
Parent is a raw type. References to generic type Parent<T>
should be parameterized
Making them parameterized like this:
public abstract sealed class Parent<T>
permits ChildA<T extends FileTypeA>, ChildB<T extends FileTypeB> {}
Or even
public abstract sealed class Parent<T>
permits ChildA<T>, ChildB<T> {}
Gives the error:
Bound mismatch: The type T is not a valid substitute for the
bounded parameter <T extends FileTypeA> of the type ChildA<T>
How to remove these warnings and errors?