List<DownloadTask> result = new ArrayList<>();
for (Class<? extends DownloadTask> taskClass : downloadTasks) {
if (taskClass != null) {
try {
DownloadTask task = taskClass.getConstructor().newInstance();
if (task.acceptsUrl(url)) {
result.add(task);
}
} catch (Exception e) {
Main.error(e);
}