Reproduce:
List<HistoricVariableInstance> result = historyService.createHistoricVariableInstanceQuery().taskIdIn(taskId1, taskId2).list();
Result / expected result:
There is no chance to check if a result relates to task1 or task2 (of course I can cast to HistoricVariableInstanceEntity, but this is not intended).