Skip to content

Commit 6abc3a3

Browse files
tkchouakiTarek Chouakisebhoerl
authored
fix: handling already existing optional config groups (#267)
Co-authored-by: Tarek Chouaki <tarek.chouaki@irt-systemx.fr> Co-authored-by: Sebastian Hörl <sebastian.horl@irt-systemx.fr>
1 parent 9d3a934 commit 6abc3a3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

core/src/main/java/org/eqasim/core/simulation/EqasimConfigurator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ protected void registerOptionalConfigGroup(ConfigGroup configGroup, Collection<A
172172

173173
public void addOptionalConfigGroups(Config config) {
174174
for (ConfigGroup configGroup : optionalConfigGroups.values()) {
175-
if (config.getModules().get(configGroup.getName()) != null) {
175+
ConfigGroup existingConfigGroup = config.getModules().get(configGroup.getName());
176+
// if a config group with the same name exist and is still a generic ConfigGroup instance, we replace it by the optional config group instance
177+
if (existingConfigGroup != null && existingConfigGroup.getClass().equals(ConfigGroup.class)) {
176178
config.addModule(configGroup);
177179
}
178180
}

0 commit comments

Comments
 (0)