Skip to content

Commit

Permalink
implement MavenTargetDependency equals comparison
Browse files Browse the repository at this point in the history
In the TargetPlatformPreferencePage, upon the Apply button, some target
definition containing some MavenTargetLocation always is rewritten to
it's .target file, when MavenTargetDependency lacks an impl of equals(),
causing MavenTargetLocation.roots to never be equal.
  • Loading branch information
haubi committed Jan 17, 2024
1 parent 5edd03c commit 2bbd68e
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2023 Christoph Läubrich and others
* Copyright (c) 2021, 2023, 2024 Christoph Läubrich and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -76,4 +76,15 @@ public boolean matches(Dependency other) {
&& Objects.equals(other.getClassifier(), getClassifier());
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return obj instanceof MavenTargetDependency other
&& Objects.equals(other.getGroupId(), getGroupId())
&& Objects.equals(other.getArtifactId(), getArtifactId())
&& Objects.equals(other.getVersion(), getVersion()) && Objects.equals(other.getType(), getType())
&& Objects.equals(other.getClassifier(), getClassifier());
}
}

0 comments on commit 2bbd68e

Please sign in to comment.