Where do you use T
in BaseEvent
definition? Define it in the following way
public abstract class BaseEvent extends EventObject
then you won't get a warning with
@Override
public void actionPerformed(BaseEvent event) { ... }
UPDATE
Suppose your BaseEvent
really required to be parametrized. Then write following
@Override
public <T> void actionPerformed(BaseEvent<T> event) { ... }
This will give you a parametrized method.
UPDATE 1
It doesn't guarantee that is a subClass of BaseEvent.
It does. <T>
is a parameter for method template. This parameter goes to BaseEvent<T>
which is subclass of EventObject
by definition.
UPDATE 2
Do not use generics at the beginning of your learning. Generics are just for additional self testing. Use raw types. Then when you start to feel them, you will parametrize them correctly.