Fix overflow false positive error detected by "strict" compile with
errorProne.
diff --git a/src/test/java/org/apache/datasketches/memory/WritableMemoryTest.java b/src/test/java/org/apache/datasketches/memory/WritableMemoryTest.java
index 9a59ed5..5559665 100644
--- a/src/test/java/org/apache/datasketches/memory/WritableMemoryTest.java
+++ b/src/test/java/org/apache/datasketches/memory/WritableMemoryTest.java
@@ -83,7 +83,7 @@
public void checkEquals() {
int len = 7;
WritableMemory wmem1 = WritableMemory.allocate(len);
- //@SuppressWarnings({"EqualsWithItself", "SelfEquals"})
+ @SuppressWarnings({"EqualsWithItself", "SelfEquals"})
//SelfEquals for Plexus, EqualsWithItself for IntelliJ
boolean eq1 = wmem1.equals(wmem1);
assertTrue(eq1);
@@ -126,7 +126,7 @@
int len = 23;
WritableMemory wmem1 = WritableMemory.allocate(len);
assertFalse(wmem1.equals(null));
- //@SuppressWarnings({"EqualsWithItself", "SelfEquals"})
+ @SuppressWarnings({"EqualsWithItself", "SelfEquals"})
//SelfEquals for Plexus, EqualsWithItself for IntelliJ
boolean eq1 = wmem1.equals(wmem1);
assertTrue(eq1);
diff --git a/src/test/java/org/apache/datasketches/memory/XxHash64Test.java b/src/test/java/org/apache/datasketches/memory/XxHash64Test.java
index ece3ee6..b6e9327 100644
--- a/src/test/java/org/apache/datasketches/memory/XxHash64Test.java
+++ b/src/test/java/org/apache/datasketches/memory/XxHash64Test.java
@@ -79,11 +79,12 @@
/*
* This test is modeled from
- * <a href="https://github.com/OpenHFT/Zero-Allocation-Hashing/blob/master/src/test/java/net/openhft/hashing/XxHashTest.java">
+ * <a href="https://github.com/OpenHFT/Zero-Allocation-Hashing/blob/master/src/test/java/net\
+ * /openhft/hashing/XxHashCollisionTest.java">
* OpenHFT/Zero-Allocation-Hashing</a> to test hash compatibility with that implementation.
+ * It is licensed under Apache License, version 2.0.
*/
@Test
- //@SuppressWarnings("ConstantOverflow")
public void collisionTest() {
WritableMemory wmem = WritableMemory.allocate(128);
wmem.putLong(0, 1);
@@ -97,12 +98,18 @@
assertEquals(h1, h2);
wmem.putLong(0, 1L + (0xBA79078168D4BAFL * 2));
- wmem.putLong(32, 2L + (0x9C90005B80000000L * 2));
+ wmem.putLong(32, 2L + (0x392000b700000000L)); //= (0x9C90005B80000000L * 2) fix overflow false pos
long h3 = wmem.xxHash64(0, wmem.getCapacity(), 0);
assertEquals(h2, h3);
}
+// @Test
+// public void fixOverflow() {
+// long out = 0x9C90005B80000000L * 2L;
+// System.out.println(Long.toHexString(out));
+// }
+
/**
* This simple test compares the output of {@link BaseState#xxHash64(long, long, long)} with the
* output of {@link net.openhft.hashing.LongHashFunction}, that itself is tested against the