diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java index 078892263..e6fe7408a 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java @@ -274,6 +274,7 @@ public final int hashCode() { * the other id to compare to. May be null. * @return true only if both LongObjectIds have identical bits. */ + @SuppressWarnings("NonOverridingEquals") public final boolean equals(AnyLongObjectId other) { return other != null ? equals(this, other) : false; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java index 80cf4b3c5..1b867861b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java @@ -317,6 +317,7 @@ public void waitUntilNotRacy() throws InterruptedException { * the other snapshot. * @return true if the two snapshots share the same information. */ + @SuppressWarnings("NonOverridingEquals") public boolean equals(FileSnapshot other) { return lastModified == other.lastModified && size == other.size && Objects.equals(fileKey, other.fileKey); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java index 978dd3a72..791829b42 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java @@ -276,6 +276,7 @@ public final int hashCode() { * the other id to compare to. May be null. * @return true only if both ObjectIds have identical bits. */ + @SuppressWarnings("NonOverridingEquals") public final boolean equals(AnyObjectId other) { return other != null ? equals(this, other) : false; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileMode.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileMode.java index d4c4d5b40..8fa8d5f7d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileMode.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileMode.java @@ -88,6 +88,7 @@ public abstract class FileMode { public static final FileMode TREE = new FileMode(TYPE_TREE, Constants.OBJ_TREE) { @Override + @SuppressWarnings("NonOverridingEquals") public boolean equals(int modeBits) { return (modeBits & TYPE_MASK) == TYPE_TREE; } @@ -97,6 +98,7 @@ public boolean equals(int modeBits) { public static final FileMode SYMLINK = new FileMode(TYPE_SYMLINK, Constants.OBJ_BLOB) { @Override + @SuppressWarnings("NonOverridingEquals") public boolean equals(int modeBits) { return (modeBits & TYPE_MASK) == TYPE_SYMLINK; } @@ -106,6 +108,7 @@ public boolean equals(int modeBits) { public static final FileMode REGULAR_FILE = new FileMode(0100644, Constants.OBJ_BLOB) { @Override + @SuppressWarnings("NonOverridingEquals") public boolean equals(int modeBits) { return (modeBits & TYPE_MASK) == TYPE_FILE && (modeBits & 0111) == 0; } @@ -115,6 +118,7 @@ public boolean equals(int modeBits) { public static final FileMode EXECUTABLE_FILE = new FileMode(0100755, Constants.OBJ_BLOB) { @Override + @SuppressWarnings("NonOverridingEquals") public boolean equals(int modeBits) { return (modeBits & TYPE_MASK) == TYPE_FILE && (modeBits & 0111) != 0; } @@ -124,6 +128,7 @@ public boolean equals(int modeBits) { public static final FileMode GITLINK = new FileMode(TYPE_GITLINK, Constants.OBJ_COMMIT) { @Override + @SuppressWarnings("NonOverridingEquals") public boolean equals(int modeBits) { return (modeBits & TYPE_MASK) == TYPE_GITLINK; } @@ -133,6 +138,7 @@ public boolean equals(int modeBits) { public static final FileMode MISSING = new FileMode(TYPE_MISSING, Constants.OBJ_BAD) { @Override + @SuppressWarnings("NonOverridingEquals") public boolean equals(int modeBits) { return modeBits == 0; } @@ -165,6 +171,7 @@ public static final FileMode fromBits(int bits) { return new FileMode(bits, Constants.OBJ_BAD) { @Override + @SuppressWarnings("NonOverridingEquals") public boolean equals(int a) { return bits == a; } @@ -206,6 +213,7 @@ private FileMode(int mode, int expType) { * a int. * @return true if the mode bits represent the same mode as this object */ + @SuppressWarnings("NonOverridingEquals") public abstract boolean equals(int modebits); /** diff --git a/tools/BUILD b/tools/BUILD index 3df7f55c8..9abecc5f7 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -60,7 +60,7 @@ java_package_configuration( "-Xep:MutableConstantField:ERROR", "-Xep:NarrowingCompoundAssignment:WARN", "-Xep:NonAtomicVolatileUpdate:ERROR", - "-Xep:NonOverridingEquals:WARN", + "-Xep:NonOverridingEquals:ERROR", "-Xep:NullableConstructor:ERROR", "-Xep:NullablePrimitive:ERROR", "-Xep:NullableVoid:ERROR",