I have two types(T,M) first one is recognized by the compiler second one isnt. any idea what am i doing wrong?
public class SendMessageResponse<T> {
private T result;
}
public class MessageResponse<M> {
private M message;
}
interface is defined this way:
public interface EventQueue<T, M> {
SendMessageResponse<T> send(String address, String message, String eventId);
void consumeBatch(String address, int numOfConsumersPerQueue, Handler<MessageResponse<M>> callback);
..
}
on impl:
public class EventQueueSQS
implements EventQueue<SendMessageResultImpl, MessageImpl> {
@Override
public SendMessageResponse send(String address, String message, String eventId) {..}
@Override
public void consumeBatch(String address, int numOfConsumerThreads, Handler<MessageResponse> callback) {
}
..
}
for the consumeBatch override method i have complication error:
Error:(164, 17) java: name clash: consumeBatch(java.lang.String,int,io.vertx.core.Handler<java.util.List<MessageResponse>>) in EventQueueSQS and consumeBatch(java.lang.String,int,io.vertx.core.Handler<java.util.List<MessageResponse<M>>>) in EventQueue have the same erasure, yet neither overrides the other
compiler force me on the method to write the impl:
public void consumeBatch(String address, int numOfConsumersPerQueue, Handler<MessageResponse<Message>> callback) {
why? I have declared it on the class level
any idea?
Perhaps the issue that Iam using Handler which holds class that has generics? I cant find the diff between SendMessageResponse or using Handler> regarding generics as the first one works and the other one doesnt