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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user