Skip to content

Commit

Permalink
Deduplicate stored launch configs of nested projects eclipse-platform…
Browse files Browse the repository at this point in the history
…#798

Fixes eclipse-platform#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.
  • Loading branch information
Bananeweizen authored and HannesWell committed Sep 29, 2024
1 parent 6d514be commit a742866
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a742866

Please sign in to comment.