I have a few classes such that:
public class XMLStatusMessage extends XMLMessage
{}
public abstract class XMLMessage implements IMessage
{}
public interface IMessageListener
{
public void onMessage( IMessage message );
}
public interface XMLMessageListener <T extends XMLMessage> extends
IMessageListener
{
public void onMessage( T message );
}
public interface XMLStatusMessageListener extends
XMLMessageListener <XMLStatusMessage>
{
@Override
public void onMessage( XMLStatusMessage message );
}
and
public class AStatusHandler implements XMLStatusMessageListener
{
//...
@Override
public void onMessage( XMLStatusMessage message )
{
//...
}
}
My problem is that AStatusHandler won't compile because I'm not also implementing public void onMessage(IMessage). I don't see why I should have to implement onMessage(IMessage) also as it already implements onMessage(XMLStatusMessage) and XMLStatusMessage is an IMessage. Is there a simple solution to this problem?