Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate stored launch configs of nested projects #798 #856

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bananeweizen
Copy link
Contributor

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.

Copy link
Contributor

github-actions bot commented Nov 11, 2023

Test Results

 1 758 files  ±0   1 758 suites  ±0   1h 39m 0s ⏱️ + 14m 36s
 3 981 tests ±0   3 958 ✅  - 1   22 💤 ±0  1 ❌ +1 
12 540 runs  ±0  12 373 ✅  - 3  164 💤 ±0  3 ❌ +3 

For more details on these failures, see this check.

Results for commit a742866. ± Comparison against base commit 6d514be.

♻️ This comment has been updated with latest results.

@laeubi
Copy link
Contributor

laeubi commented Nov 30, 2023

@Bananeweizen master is open do you like to finish this?

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice enhancement, the issue bothered me as well.
The same could be done for PDE's target files which are also found multiple times, in the preferences and by Oomph (not sure if it is Oomph's fault).

Comment on lines 653 to +662
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just one line?

return Objects.hash(getName(), getContainer(), getLocation());

@SarikaSinha
Copy link
Member

@Bananeweizen
Can you take this to closure?

@jukzi jukzi force-pushed the duplicate_m2e_launch_configs branch from 8ef4484 to a359e6e Compare March 8, 2024 12:42
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bananeweizen do you have plans to complete this?

@@ -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()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(equalOrNull(getContainer(), config.getContainer()) || equalOrNull(getLocation(), config.getLocation()));
(Objects.equals(getContainer(), config.getContainer()) || Objects.equals(getLocation(), config.getLocation()));

…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stored launch configs of nested projects shown twice
4 participants