diff --git a/src/main/java/net/sf/jabref/gui/openoffice/OOBibBase.java b/src/main/java/net/sf/jabref/gui/openoffice/OOBibBase.java index 400f5219ae1..781a16a4cf5 100644 --- a/src/main/java/net/sf/jabref/gui/openoffice/OOBibBase.java +++ b/src/main/java/net/sf/jabref/gui/openoffice/OOBibBase.java @@ -1342,6 +1342,10 @@ public int compareTo(ComparableMark other) { @Override public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o instanceof ComparableMark) { ComparableMark other = (ComparableMark) o; return (this.position.X == other.position.X) && (this.position.Y == other.position.Y) diff --git a/src/main/java/net/sf/jabref/importer/ImportFileFilter.java b/src/main/java/net/sf/jabref/importer/ImportFileFilter.java index 5c42c54cb23..8d2e5d9fe9c 100644 --- a/src/main/java/net/sf/jabref/importer/ImportFileFilter.java +++ b/src/main/java/net/sf/jabref/importer/ImportFileFilter.java @@ -73,6 +73,9 @@ public int compareTo(ImportFileFilter o) { @Override public boolean equals(Object o) { + if(this == o) { + return true; + } if (o instanceof ImportFileFilter) { return name.equals(((ImportFileFilter) o).name); } diff --git a/src/main/java/net/sf/jabref/importer/fileformat/ImportFormat.java b/src/main/java/net/sf/jabref/importer/fileformat/ImportFormat.java index 3df58101cec..d394f601d2a 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/ImportFormat.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/ImportFormat.java @@ -164,8 +164,8 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if(obj == null) { - return false; + if (this == obj) { + return true; } if(!(obj instanceof ImportFormat)) { return false; diff --git a/src/main/java/net/sf/jabref/logic/groups/ExplicitGroup.java b/src/main/java/net/sf/jabref/logic/groups/ExplicitGroup.java index 36552f196f6..d204665717e 100644 --- a/src/main/java/net/sf/jabref/logic/groups/ExplicitGroup.java +++ b/src/main/java/net/sf/jabref/logic/groups/ExplicitGroup.java @@ -96,6 +96,9 @@ public AbstractGroup deepCopy() { @Override public boolean equals(Object o) { + if (this == o) { + return true; + } if (!(o instanceof ExplicitGroup)) { return false; } diff --git a/src/main/java/net/sf/jabref/logic/groups/KeywordGroup.java b/src/main/java/net/sf/jabref/logic/groups/KeywordGroup.java index 72906fb38ae..329e0dd40bb 100644 --- a/src/main/java/net/sf/jabref/logic/groups/KeywordGroup.java +++ b/src/main/java/net/sf/jabref/logic/groups/KeywordGroup.java @@ -187,6 +187,9 @@ public Optional remove(List entriesToRemove) { @Override public boolean equals(Object o) { + if (this == o) { + return true; + } if (!(o instanceof KeywordGroup)) { return false; } diff --git a/src/main/java/net/sf/jabref/logic/groups/SearchGroup.java b/src/main/java/net/sf/jabref/logic/groups/SearchGroup.java index e2ded390473..9231b635431 100644 --- a/src/main/java/net/sf/jabref/logic/groups/SearchGroup.java +++ b/src/main/java/net/sf/jabref/logic/groups/SearchGroup.java @@ -119,6 +119,9 @@ public Optional remove(List entriesToRemove) { @Override public boolean equals(Object o) { + if (this == o) { + return true; + } if (!(o instanceof SearchGroup)) { return false; } diff --git a/src/main/java/net/sf/jabref/logic/openoffice/CitationEntry.java b/src/main/java/net/sf/jabref/logic/openoffice/CitationEntry.java index cd27648378c..a13e0bf96d1 100644 --- a/src/main/java/net/sf/jabref/logic/openoffice/CitationEntry.java +++ b/src/main/java/net/sf/jabref/logic/openoffice/CitationEntry.java @@ -70,6 +70,9 @@ public int compareTo(CitationEntry other) { @Override public boolean equals(Object o) { + if (this == o) { + return true; + } if (o instanceof CitationEntry) { CitationEntry other = (CitationEntry) o; return this.refMarkName.equals(other.refMarkName); diff --git a/src/main/java/net/sf/jabref/logic/openoffice/OOBibStyle.java b/src/main/java/net/sf/jabref/logic/openoffice/OOBibStyle.java index 7d1396c3a5f..a18054eb421 100644 --- a/src/main/java/net/sf/jabref/logic/openoffice/OOBibStyle.java +++ b/src/main/java/net/sf/jabref/logic/openoffice/OOBibStyle.java @@ -888,15 +888,21 @@ public int compareTo(OOBibStyle other) { @Override public boolean equals(Object o) { + if (this == o) { + return true; + } if (o instanceof OOBibStyle) { - return path.equals(((OOBibStyle) o).path); + OOBibStyle otherStyle = (OOBibStyle) o; + return Objects.equals(path, otherStyle.path) && Objects.equals(name, otherStyle.name) + && Objects.equals(citProperties, otherStyle.citProperties) + && Objects.equals(properties, otherStyle.properties); } return false; } @Override public int hashCode() { - return Objects.hash(path); + return Objects.hash(path, name, citProperties, properties); } private String createAuthorList(String author, int maxAuthors, String andString, diff --git a/src/main/java/net/sf/jabref/model/entry/CustomEntryType.java b/src/main/java/net/sf/jabref/model/entry/CustomEntryType.java index 4cce33a174d..e23ecf79ba7 100644 --- a/src/main/java/net/sf/jabref/model/entry/CustomEntryType.java +++ b/src/main/java/net/sf/jabref/model/entry/CustomEntryType.java @@ -19,6 +19,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -78,8 +79,11 @@ public int compareTo(EntryType o) { @Override public boolean equals(Object o) { + if (this == o) { + return true; + } if (o instanceof CustomEntryType) { - return this.compareTo((CustomEntryType) o) == 0; + return Objects.equals(name, ((CustomEntryType) o).name); } else { return false; }