From 6f215c609b95ba2fa466ae4ae53761dcb7d4bcac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Galland?= Date: Fri, 28 Feb 2020 23:01:04 +0100 Subject: [PATCH] [sre] Do not uninstall the same skill multiple times when it registered for mutiple capacities. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Galland --- .../io/sarl/sre/services/lifecycle/SkillUninstaller.sarl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sre/io.janusproject/io.janusproject.plugin/src/io/sarl/sre/services/lifecycle/SkillUninstaller.sarl b/sre/io.janusproject/io.janusproject.plugin/src/io/sarl/sre/services/lifecycle/SkillUninstaller.sarl index e7c7e68ff3..94592d07ca 100644 --- a/sre/io.janusproject/io.janusproject.plugin/src/io/sarl/sre/services/lifecycle/SkillUninstaller.sarl +++ b/sre/io.janusproject/io.janusproject.plugin/src/io/sarl/sre/services/lifecycle/SkillUninstaller.sarl @@ -30,7 +30,8 @@ import io.sarl.lang.core.Skill import io.sarl.lang.core.Skill.UninstallationStage import io.sarl.sre.skills.bic.SchedulesSkill import io.sarl.sre.skills.internal.InternalEventBusSkill -import java.util.ArrayList +import java.util.HashSet +import java.util.Set /** * Install and uninstall the skills. @@ -80,13 +81,13 @@ class BasicSkillUninstaller implements SkillUninstaller { * * @return the skills. */ - private static def getAllSkills(^agent : Agent) : Iterable { + private static def getAllSkills(^agent : Agent) : Set { // Get the registered skills val skills = SREutils.getSkillRepository(^agent) if (skills !== null) { - return new ArrayList(Collections2.transform(skills.values) [it.get]) + return new HashSet(Collections2.transform(skills.values) [it.get]) } - return emptyList + return emptySet } def uninstallSkillsBeforeDestroy(^agent : Agent) : Iterable {