]> source.dussan.org Git - jgit.git/commitdiff
Suppress "Unlikely argument type for equals()" warnings in tests 61/106061/4
authorDavid Pursehouse <david.pursehouse@gmail.com>
Sun, 1 Oct 2017 05:08:17 +0000 (06:08 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 6 Nov 2017 09:34:34 +0000 (10:34 +0100)
This new warning was introduced in Eclipse 4.7 Oxygen [1].

The only instances of the warning are in test code that is asserting
that some class does not compare equal to Strings. As in the Gerrit
project [2] these asserts are arguably overkill, but arguably also
a reasonable test of an equals implementation. Ignore the warning in
these cases.

Note that if the project is opened in an earlier version of Eclipse,
a warning "Unsupported @SuppressWarnings" will be emitted.

[1] https://www.eclipse.org/eclipse/news/4.7/M6/
[2] https://gerrit-review.googlesource.com/#/c/gerrit/+/110339/

Change-Id: I08ea33d71e6009cf0f37e6492a475931f447256b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectIdTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditListTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java

index 8938a7875decadbc4acf27e7be397b7d41ec814c..2a8f66e4cc808c9a89264182733817718d0cda53 100644 (file)
@@ -587,6 +587,7 @@ public class AbbreviatedLongObjectIdTest {
                assertEquals(id.getFirstByte(), a.getFirstByte());
        }
 
+       @SuppressWarnings("unlikely-arg-type")
        @Test
        public void testNotEquals() {
                AbbreviatedLongObjectId a = new LongObjectId(1L, 2L, 3L, 4L)
index d6a5dcde2bfd6b5697ed3eea30fc14a3f7dff294..70447c7d5d761b9a84aa5f479face99bcdc65ba2 100644 (file)
@@ -53,6 +53,7 @@ import java.util.Iterator;
 import org.junit.Test;
 
 public class EditListTest {
+       @SuppressWarnings("unlikely-arg-type")
        @Test
        public void testEmpty() {
                final EditList l = new EditList();
index 1a0c39ebfe5aefa58991084aa60c4f4124418816..c621a7fab481fe3bb34d322eb93329971fd6ae41 100644 (file)
@@ -125,6 +125,7 @@ public class EditTest {
                assertEquals("REPLACE(1-2,1-4)", e.toString());
        }
 
+       @SuppressWarnings("unlikely-arg-type")
        @Test
        public void testEquals1() {
                final Edit e1 = new Edit(1, 2, 3, 4);
index 95e7ca6d561647afbb5ccea6b13ec4ef42daa187..122a3973d0f560e77a57b98e2fffb74c0741d1db 100644 (file)
@@ -60,6 +60,7 @@ public class RevObjectTest extends RevWalkTestCase {
                assertSame(a, a.getId());
        }
 
+       @SuppressWarnings("unlikely-arg-type")
        @Test
        public void testEquals() throws Exception {
                final RevCommit a1 = commit();