Skip to content
Permalink
Browse files
Merge pull request #396 from apache/cleanupWarnings
Cleanup warnings
  • Loading branch information
leerho committed Apr 29, 2022
2 parents 850d0b5 + 05fd993 commit f02347ad20cfa927507199d1dc0cb9c8c18a1d36
Showing 170 changed files with 20 additions and 188 deletions.
@@ -42,7 +42,6 @@
* @author Lee Rhodes
* @author Kevin Lang
*/
@SuppressWarnings("javadoc")
public class CompressionCharacterization {
private String hfmt;
private String dfmt;
@@ -37,7 +37,6 @@
* @author Lee Rhodes
* @author Kevin Lang
*/
@SuppressWarnings("javadoc")
public class MergingValidation {
private String hfmt;
private String dfmt;
@@ -37,7 +37,6 @@
* @author Lee Rhodes
* @author Kevin Lang
*/
@SuppressWarnings("javadoc")
public class QuickMergingValidation {
private String hfmt;
private String dfmt;
@@ -35,7 +35,6 @@
* @author Lee Rhodes
* @author Kevin Lang
*/
@SuppressWarnings("javadoc")
public class StreamingValidation {
private String hfmt;
private String dfmt;
@@ -482,7 +482,6 @@ public void reset() {
* @param serDe an instance of ArrayOfItemsSerDe
* @return a byte array representation of this sketch
*/
@SuppressWarnings("null")
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
final int preLongs;
final int outBytes;
@@ -24,14 +24,13 @@
/**
* The XxHash is a fast, non-cryptographic, 64-bit hash function that has
* excellent avalanche and 2-way bit independence properties.
*
* <p>This class wraps the
*
* <p>This class wraps the
* <a href="https://github.com/apache/datasketches-memory/blob/master/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/XxHash.java">Memory Component XxHash</a>
* implementation.
*
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class XxHash {

/**
@@ -51,7 +51,6 @@
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public enum TgtHllType { HLL_4, HLL_6, HLL_8;

private static final TgtHllType values[] = values();
@@ -145,7 +145,6 @@ public void reset() {
}

//@formatter:off
@SuppressWarnings("null")
static UpdateDoublesSketch updateLogic(final int myMaxK, final UpdateDoublesSketch myQS,
final DoublesSketch other) {
int sw1 = ((myQS == null) ? 0 : myQS.isEmpty() ? 4 : 8);
@@ -532,7 +532,6 @@ public boolean isEmpty() {
/**
* @return true if this sketch is off-heap
*/
@SuppressWarnings("static-method")
public boolean isDirect() {
return false;
}
@@ -254,7 +254,7 @@ public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
}

//@formatter:off
@SuppressWarnings({"null", "unchecked"})
@SuppressWarnings("unchecked")
static <T> ItemsSketch<T> updateLogic(final int myMaxK, final Comparator<? super T> comparator,
final ItemsSketch<T> myQS, final ItemsSketch<T> other) {
int sw1 = ((myQS == null) ? 0 : myQS.isEmpty() ? 4 : 8);
@@ -460,7 +460,7 @@ public byte[] toByteArray(final ArrayOfItemsSerDe<? super T> serDe) {
* @param clazz The class represented by &lt;T&gt;
* @return a byte array representation of this sketch
*/
@SuppressWarnings("null") // bytes will be null only if empty == true
// bytes will be null only if empty == true
public byte[] toByteArray(final ArrayOfItemsSerDe<? super T> serDe, final Class<?> clazz) {
final int preLongs, outBytes;
final boolean empty = itemsSeen_ == 0;
@@ -286,7 +286,7 @@ public String toString() {
* @param clazz A class to which the items are cast before serialization
* @return a byte array representation of this union
*/
@SuppressWarnings("null") // gadgetBytes will be null only if gadget_ == null AND empty == true
// gadgetBytes will be null only if gadget_ == null AND empty == true
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe, final Class<?> clazz) {
final int preLongs, outBytes;
final boolean empty = gadget_ == null;
@@ -326,7 +326,7 @@ private void createNewGadget(final ReservoirItemsSketch<T> sketchIn,
if ((sketchIn.getK() < maxK_) && (sketchIn.getN() <= sketchIn.getK())) {
// incoming sketch is in exact mode with sketch's k < maxK,
// so we can create a gadget at size maxK and keep everything
// NOTE: assumes twoWayMergeInternal first checks if sketchIn is in exact mode
//Assumes twoWayMergeInternal first checks if sketchIn is in exact mode
gadget_ = ReservoirItemsSketch.newInstance(maxK_);
twoWayMergeInternal(sketchIn, isModifiable); // isModifiable could be fixed to false here
} else {
@@ -239,7 +239,7 @@ public String toString() {
*
* @return a byte array representation of this union
*/
@SuppressWarnings("null") // gadgetBytes will be null only if gadget_ == null AND empty == true
// gadgetBytes will be null only if gadget_ == null AND empty == true
public byte[] toByteArray() {
final int preLongs, outBytes;
final boolean empty = gadget_ == null;
@@ -258,7 +258,6 @@ static <T> VarOptItemsSketch<T> newInstanceFromUnionResult(final ArrayList<T> da
return sketch;
}


/**
* Returns a sketch instance of this class from the given srcMem,
* which must be a Memory representation of this sketch class.
@@ -269,7 +268,6 @@ static <T> VarOptItemsSketch<T> newInstanceFromUnionResult(final ArrayList<T> da
* @param serDe An instance of ArrayOfItemsSerDe
* @return a sketch instance of this class
*/
@SuppressWarnings("null")
public static <T> VarOptItemsSketch<T> heapify(final Memory srcMem,
final ArrayOfItemsSerDe<T> serDe) {
final int numPreLongs = getAndCheckPreLongs(srcMem);
@@ -566,7 +564,7 @@ public byte[] toByteArray(final ArrayOfItemsSerDe<? super T> serDe) {
* @param clazz The class represented by &lt;T&gt;
* @return a byte array representation of this sketch
*/
@SuppressWarnings("null") // bytes will be null only if empty == true
// bytes will be null only if empty == true
public byte[] toByteArray(final ArrayOfItemsSerDe<? super T> serDe, final Class<?> clazz) {
final int preLongs, numMarkBytes, outBytes;
final boolean empty = (r_ == 0) && (h_ == 0);
@@ -314,7 +314,7 @@ public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
* @param clazz A class to which the items are cast before serialization
* @return a byte array representation of this union
*/
@SuppressWarnings("null") // gadgetBytes will be null only if gadget_ == null AND empty == true
// gadgetBytes will be null only if gadget_ == null AND empty == true
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe, final Class<?> clazz) {
final int preLongs, outBytes;
final boolean empty = gadget_.getNumSamples() == 0;
@@ -58,7 +58,6 @@ public static ExecutorService resetExecutorService(final long id) {
return getInstance().propagationExecutorService[(int) id % NUM_POOL_THREADS] = null;
}

@SuppressWarnings("static-method")
private ExecutorService initExecutorService(final int i) {
if (propagationExecutorService[i] == null) {
propagationExecutorService[i] = Executors.newSingleThreadExecutor();
@@ -109,7 +109,6 @@
*
* @param skA The incoming sketch for the first argument, <i>A</i>.
*/
@SuppressWarnings("unchecked")
public void setA(final Sketch<S> skA) {
if (skA == null) {
reset();
@@ -141,7 +140,6 @@ public void setA(final Sketch<S> skA) {
*
* @param skB The incoming Tuple sketch for the second (or following) argument <i>B</i>.
*/
@SuppressWarnings("unchecked")
public void notB(final Sketch<S> skB) {
if (skB == null) { return; } //ignore

@@ -214,7 +212,6 @@ public void notB(final Sketch<S> skB) {
*
* @param skB The incoming Theta sketch for the second (or following) argument <i>B</i>.
*/
@SuppressWarnings("unchecked")
public void notB(final org.apache.datasketches.theta.Sketch skB) {
if (skB == null) { return; } //ignore

@@ -311,7 +308,6 @@ public CompactSketch<S> getResult(final boolean reset) {
* @param <S> Type of Summary
* @return the result as an unordered {@link CompactSketch}
*/
@SuppressWarnings("unchecked")
public static <S extends Summary> CompactSketch<S> aNotB(
final Sketch<S> skA,
final Sketch<S> skB) {
@@ -403,7 +399,6 @@ public static <S extends Summary> CompactSketch<S> aNotB(
* @param <S> Type of Summary
* @return the result as an unordered {@link CompactSketch}
*/
@SuppressWarnings("unchecked")
public static <S extends Summary> CompactSketch<S> aNotB(
final Sketch<S> skA,
final org.apache.datasketches.theta.Sketch skB) {
@@ -480,7 +475,6 @@ public static <S extends Summary> CompactSketch<S> aNotB(
S[] summaryArr;
}

@SuppressWarnings("unchecked")
private static <S extends Summary> DataArrays<S> getCopyOfDataArraysTuple(
final Sketch<S> sk) {
final CompactSketch<S> csk;
@@ -71,7 +71,6 @@ private enum Flags { IS_BIG_ENDIAN, IS_READ_ONLY, IS_EMPTY, IS_COMPACT, IS_ORDER
* @param mem Memory object with serialized CompactSketch
* @param deserializer the SummaryDeserializer
*/
@SuppressWarnings({"unchecked"})
CompactSketch(final Memory mem, final SummaryDeserializer<S> deserializer) {
int offset = 0;
final byte preambleLongs = mem.getByte(offset++);
@@ -189,7 +188,6 @@ public int getCountLessThanThetaLong(final long thetaLong) {
// Adr:
// || 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// 0 || seed hash | Flags | unused | SkType | FamID | SerVer | Preamble_Longs |
@SuppressWarnings("null")
@Override
public byte[] toByteArray() {
final int count = getRetainedEntries();
@@ -349,7 +349,6 @@ public CompactSketch<S> compact() {
* Serializing a CompactSketch is not deprecated.
*/
@Deprecated
@SuppressWarnings("null")
@Override
public byte[] toByteArray() {
byte[][] summariesBytes = null;
@@ -507,7 +506,6 @@ private void updateTheta() {
thetaLong_ = QuickSelect.select(hashArr, 0, count_ - 1, nomEntries_);
}

@SuppressWarnings({"unchecked"})
private void resize(final int newSize) {
final long[] oldHashTable = hashTable_;
final S[] oldSummaryTable = summaryTable_;