Skip to content

Commit

Permalink
refactor: adjust equals impl in Identifier
Browse files Browse the repository at this point in the history
(cherry picked from commit 0627fb2)
  • Loading branch information
WiIIiam278 committed Nov 15, 2024
1 parent 8d801fa commit 526f231
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.intellij.lang.annotations.Subst;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.Comparator;
Expand Down Expand Up @@ -229,11 +230,8 @@ public String toString() {
* @return {@code true} if the given object is an identifier with the same key as this identifier
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof Identifier other) {
return key.equals(other.key);
}
return false;
public boolean equals(@Nullable Object obj) {
return obj instanceof Identifier other ? toString().equals(other.toString()) : super.equals(obj);
}

// Get the config entry for the identifier
Expand Down

0 comments on commit 526f231

Please sign in to comment.