refactor(module): use Objects.toIdentityString for module ID generation

This commit is contained in:
extio-de
2025-12-29 18:29:29 +01:00
parent d806c6aa94
commit 87fcf5ee0f
2 changed files with 3 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package de.extio.game_engine.module; package de.extio.game_engine.module;
import java.util.List; import java.util.List;
import java.util.Objects;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -12,7 +13,7 @@ public abstract class AbstractModule {
protected final Logger LOGGER = LoggerFactory.getLogger(AbstractModule.class); protected final Logger LOGGER = LoggerFactory.getLogger(AbstractModule.class);
protected String id = "Module_" + System.identityHashCode(this); protected String id = Objects.toIdentityString(this);
private ModuleService moduleService; private ModuleService moduleService;

View File

@@ -104,7 +104,7 @@ public class ModuleServiceImpl implements ModuleService, ApplicationListener<Con
synchronized (this.modulesAll) { synchronized (this.modulesAll) {
this.modulesAllView = List.copyOf(this.modulesAll); this.modulesAllView = List.copyOf(this.modulesAll);
} }
LOGGER.debug("Loaded module {} {}", module.getClass().getName(), module.getId()); LOGGER.debug("Loaded module {} {}", module.getId());
this.invokeSafe(module, m -> m.onLoad()); this.invokeSafe(module, m -> m.onLoad());
} }