You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2020/01/15 05:21:04 UTC
[incubator-datasketches-java] 01/01: Fix and/or filter some SpotBugs
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch SpotBugs
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git
commit f14def37c4baeb0daa227466290895097da5f9ad
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Tue Jan 14 21:20:46 2020 -0800
Fix and/or filter some SpotBugs
---
src/main/java/org/apache/datasketches/hll/TgtHllType.java | 2 +-
.../java/org/apache/datasketches/hll/IsomorphicTest.java | 7 ++-----
.../java/org/apache/datasketches/hll/UnionCaseTest.java | 7 ++++---
tools/FindBugsExcludeFilter.xml | 14 ++++++++++++++
4 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/hll/TgtHllType.java b/src/main/java/org/apache/datasketches/hll/TgtHllType.java
index 49fc8a8..4c0a8a4 100644
--- a/src/main/java/org/apache/datasketches/hll/TgtHllType.java
+++ b/src/main/java/org/apache/datasketches/hll/TgtHllType.java
@@ -54,7 +54,7 @@ package org.apache.datasketches.hll;
@SuppressWarnings("javadoc")
public enum TgtHllType { HLL_4, HLL_6, HLL_8;
- public static final TgtHllType values[] = values();
+ private static final TgtHllType values[] = values();
public static final TgtHllType fromOrdinal(final int typeId) {
return values[typeId];
diff --git a/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
index 3c22927..d896b7d 100644
--- a/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
+++ b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
@@ -36,9 +36,6 @@ import org.testng.annotations.Test;
@SuppressWarnings({"javadoc", "unused"})
public class IsomorphicTest {
long v = 0;
- final int maxLgK = 12;
- HllSketch source;
- Union union;
@Test
//Merges a type1 to an empty union (heap, HLL_8), and gets result as type1, checks binary equivalence
@@ -227,7 +224,7 @@ public class IsomorphicTest {
bytesOut6 = u.getResult(HLL_8).toUpdatableByteArray();//should be identical except for HllAccum
comb = "LgK: " + lgK + ", SkType: HLL_6, Compared with SkType HLL_8";
- checkArrays(bytesOut8, bytesOut6, comb, true);
+ checkArrays(bytesOut8, bytesOut6, comb, false);
u = buildHeapUnionHllMode(lgK, 0);
sk = buildHeapSketchHllMode(lgK, HLL_4, 1 << lgK);
@@ -235,7 +232,7 @@ public class IsomorphicTest {
bytesOut4 = u.getResult(HLL_8).toUpdatableByteArray();//should be identical except for HllAccum
comb = "LgK: " + lgK + ", SkType: HLL_4, Compared with SkType HLL_8";
- checkArrays(bytesOut8, bytesOut4, comb, true);
+ checkArrays(bytesOut8, bytesOut4, comb, false);
}
}
diff --git a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
index 03c6d4e..c6bf77c 100644
--- a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
+++ b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
@@ -40,11 +40,12 @@ import org.testng.annotations.Test;
*/
@SuppressWarnings("javadoc")
public class UnionCaseTest {
+ private static final String LS = System.getProperty("line.separator");
long v = 0;
- final int maxLgK = 12;
+ final static int maxLgK = 12;
HllSketch source;
- Union union;
- String hfmt = "%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s\n";
+ //Union union;
+ String hfmt = "%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s" + LS;
String hdr = String.format(hfmt, "caseNum","srcLgKStr","gdtLgKStr","srcType","gdtType",
"srcMem","gdtMem","srcMode","gdtMode","srcOoof","gdtOoof");
diff --git a/tools/FindBugsExcludeFilter.xml b/tools/FindBugsExcludeFilter.xml
index 256040e..e5fd93e 100644
--- a/tools/FindBugsExcludeFilter.xml
+++ b/tools/FindBugsExcludeFilter.xml
@@ -44,6 +44,20 @@ under the License.
<Class name="~.*\.*Test" />
</Match>
+ <Match>
+ <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS" />
+ <Class name="~.*\.Group" />
+ </Match>
+
+ <Match>
+ <Bug pattern="VO_VOLATILE_INCREMENT" />
+ <Class name="~.*\.Concurrent.+QuickSelectSketch" />
+ </Match>
+
+ <Match>
+ <Class name="~.*\.TestAllTest" />
+ </Match>
+
<Match> <!-- Exclude for test classes; too many False Positives. -->
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT" />
<Class name="~.*\.*Test" />
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org