From 8ef4484c4cceb2e6504b0694bfb68eddb4d2f58b Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Sat, 11 Nov 2023 16:25:23 +0100 Subject: [PATCH] Deduplicate stored launch configs of nested projects #798 Fixes #798. m2e projects can be nested (e.g. modules stored inside a reactor). Launch configs stored the inner nested projects appear twice, because they are not equal with the old implementation checking only name and container. Therefore also check the resolved location if the containers are different. I've tested this with an m2e IDE containing such nested projects and stored launch configs. The duplicates are gone with the change. --- .../debug/internal/core/LaunchConfiguration.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java index abe6470dd73..320ef21685c 100644 --- a/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java +++ b/debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java @@ -369,7 +369,7 @@ public boolean equals(Object object) { LaunchConfiguration config = (LaunchConfiguration) object; if (!config.isWorkingCopy()) { return getName().equals(config.getName()) && - equalOrNull(getContainer(), config.getContainer()); + (equalOrNull(getContainer(), config.getContainer()) || equalOrNull(getLocation(), config.getLocation())); } } return false; @@ -651,11 +651,15 @@ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException { @Override public int hashCode() { IContainer container = getContainer(); - if (container == null) { - return getName().hashCode(); - } else { - return getName().hashCode() + container.hashCode(); + int result = getName().hashCode(); + if (container != null) { + result += container.hashCode(); + } + IPath location = getLocation(); + if (location != null) { + result += location.hashCode(); } + return result; } @Override