I am facing a confusing issue in my code.
I have one method which signature is
public <T extends Measure> void sendNewMeasure(Class<T> type, T measure);
In another class, I have this method, which calls the previous one :
public <T extends Measure> void onNewMeasure(NewMeasureEvent<T> event) {
T measure = event.getMeasure();
APIInterface.getInstance().sendNewMeasure(measure.getClass(), measure);
}
The error I get is Wrong argument type, found 'T', required <? extends com.blablabla.Measure>
but I don't get why, as the measure object is of type T which extends Measure.
Is there any way to fix this, and most importantly, why is it not working ?
Thanks !
EDIT :
This is the implementation of the sendNewMeasure method :
public <T extends Measure> void sendNewMeasure(Class<T> type, T measure) {
String measureType = measure.getJSONMeasureTypeName();
List<T> measures = T.find(type, measure.timestamp, true, false);
measures.add(measure);
sendMeasures(siteId, sensorId, measureType, measures);
}
EDIT 2 : And this is the find method signature, the one I cannot change:
public static <T> List<T> find(Class<T> type, int timestamp, boolean includeStart, boolean inclueEnd);