mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
GitBranch.equals(): simplify, allow subclasses, add null-check to the super.equals
This commit is contained in:
@@ -109,9 +109,9 @@ public class GitBranch extends GitReference {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reusing equals from super: only the name is important:
|
||||
// branches are considered equal even if they point to different commits.
|
||||
|
||||
@@ -50,6 +50,10 @@ public abstract class GitReference implements Comparable<GitReference> {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return obj instanceof GitReference && getFullName().equals(((GitReference)obj).getFullName());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user