GH-102 - Avoid topological sorting to fail on cyclic module graphs.

We now fall back to the default non-topological ordering in case the application module graph contains cycles.
This commit is contained in:
Oliver Drotbohm
2023-01-05 11:21:14 +01:00
parent 30203ecca8
commit d8463bb84b

View File

@@ -554,10 +554,16 @@ public class ApplicationModules implements Iterable<ApplicationModule> {
});
var names = new ArrayList<String>();
var iterator = new TopologicalOrderIterator<>(graph);
new TopologicalOrderIterator<>(graph).forEachRemaining(it -> names.add(0, it.getName()));
try {
return names;
iterator.forEachRemaining(it -> names.add(0, it.getName()));
return names;
} catch (IllegalArgumentException o_O) {
return modules.modules.values().stream().map(ApplicationModule::getName).toList();
}
}
}
}