Skip to content

Commit 2994201

Browse files
authored
Merge pull request #271 from apache/SuppressWarnings
Enable warnings for main tree, add suppress warnings for test tree.
2 parents f8e9c8f + 97dc661 commit 2994201

142 files changed

Lines changed: 397 additions & 197 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/yahoo/sketches/theta/Sketch.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,6 @@ private static final boolean estMode(final long thetaLong, final boolean empty)
644644

645645
/**
646646
* Instantiates a Heap Sketch from Memory. SerVer 1 & 2 already handled.
647-
* @param famID the Family ID
648-
* @param ordered true if the sketch is of the Compact family and ordered
649647
* @param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
650648
* @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
651649
* The seed required to instantiate a non-compact sketch.

src/main/java/com/yahoo/sketches/theta/UnionImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ private UnionImpl(final UpdateSketch gadget, final long seed) {
8787
*/
8888
static UnionImpl initNewHeapInstance(final int lgNomLongs, final long seed, final float p,
8989
final ResizeFactor rf) {
90-
final UpdateSketch gadget = new HeapQuickSelectSketch(
91-
lgNomLongs, seed, p, rf, true); //create with UNION family
90+
final UpdateSketch gadget = //create with UNION family
91+
new HeapQuickSelectSketch(lgNomLongs, seed, p, rf, true);
9292
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
9393
unionImpl.unionThetaLong_ = gadget.getThetaLong();
9494
unionImpl.unionEmpty_ = gadget.isEmpty();
@@ -114,8 +114,8 @@ static UnionImpl initNewDirectInstance(
114114
final ResizeFactor rf,
115115
final MemoryRequestServer memReqSvr,
116116
final WritableMemory dstMem) {
117-
final UpdateSketch gadget = new DirectQuickSelectSketch(
118-
lgNomLongs, seed, p, rf, memReqSvr, dstMem, true); //create with UNION family
117+
final UpdateSketch gadget = //create with UNION family
118+
new DirectQuickSelectSketch(lgNomLongs, seed, p, rf, memReqSvr, dstMem, true);
119119
final UnionImpl unionImpl = new UnionImpl(gadget, seed);
120120
unionImpl.unionThetaLong_ = gadget.getThetaLong();
121121
unionImpl.unionEmpty_ = gadget.isEmpty();

src/main/java/com/yahoo/sketches/tuple/adouble/DoubleSummaryDeserializer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import com.yahoo.sketches.tuple.DeserializeResult;
2424
import com.yahoo.sketches.tuple.SummaryDeserializer;
2525

26+
/**
27+
* @author Lee Rhodes
28+
*/
2629
public class DoubleSummaryDeserializer implements SummaryDeserializer<DoubleSummary> {
2730

2831
@Override

src/main/java/com/yahoo/sketches/tuple/strings/ArrayOfStringsSummary.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @author Lee Rhodes
3535
*/
3636
public class ArrayOfStringsSummary implements UpdatableSummary<String[]> {
37-
public static final int PRIME = 0x7A3C_CA71;
37+
private static final int PRIME = 0x7A3C_CA71;
3838
private String[] nodesArr = null;
3939

4040
ArrayOfStringsSummary() { //required for ArrayOfStringsSummaryFactory
@@ -90,6 +90,9 @@ public ArrayOfStringsSummary copy() {
9090
return nodes;
9191
}
9292

93+
/**
94+
* @return the nodes array for this summary.
95+
*/
9396
public String[] getValue() {
9497
return nodesArr.clone();
9598
}
@@ -154,6 +157,10 @@ static long stringArrHash(final String[] strArray) {
154157
return XxHash64.hashChars(s.toCharArray(), 0, s.length(), PRIME);
155158
}
156159

160+
/**
161+
* @param s the string to hash
162+
* @return the hash of the string
163+
*/
157164
public static long stringHash(final String s) {
158165
return XxHash64.hashChars(s.toCharArray(), 0, s.length(), PRIME);
159166
}

src/test/java/com/yahoo/sketches/BinomialBoundsNTest.java

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
/**
3232
* @author Kevin Lang
3333
*/
34+
@SuppressWarnings("javadoc")
3435
public class BinomialBoundsNTest {
3536

3637
public static double[] runTestAux (long max_numSamplesI, int ci, double min_p) {
@@ -41,54 +42,54 @@ public static double[] runTestAux (long max_numSamplesI, int ci, double min_p) {
4142
double sum3 = 0.0;
4243
double sum4 = 0.0;
4344
long count = 0;
44-
45+
4546
while (numSamplesI <= max_numSamplesI) { /* was <= */
4647
p = 1.0;
47-
48+
4849
while (p >= min_p) {
4950
lb = BinomialBoundsN.getLowerBound (numSamplesI, p, ci, false);
5051
ub = BinomialBoundsN.getUpperBound (numSamplesI, p, ci, false);
51-
52+
5253
// if (numSamplesI == 300 && p > 0.365 && p < 0.367) { ub += 0.01; } // artificial discrepancy
53-
54+
5455
// the logarithm helps discrepancies to not be swamped out of the total
55-
sum1 += Math.log (lb + 1.0);
56+
sum1 += Math.log (lb + 1.0);
5657
sum2 += Math.log (ub + 1.0);
5758
count += 2;
58-
59+
5960
if (p < 1.0) {
6061
lb = BinomialBoundsN.getLowerBound (numSamplesI, 1.0 - p, ci, false);
6162
ub = BinomialBoundsN.getUpperBound (numSamplesI, 1.0 - p, ci, false);
6263
sum3 += Math.log (lb + 1.0);
6364
sum4 += Math.log (ub + 1.0);
6465
count += 2;
6566
}
66-
67+
6768
p *= 0.99;
6869
}
69-
numSamplesI = Math.max (numSamplesI+1, 1001*numSamplesI/1000);
70+
numSamplesI = Math.max (numSamplesI+1, (1001*numSamplesI)/1000);
7071
}
71-
72+
7273
println(String.format("{%.15e, %.15e, %.15e, %.15e, %d}", sum1, sum2, sum3, sum4, count));
7374
double[] arrOut = {sum1, sum2, sum3, sum4, count};
7475
return arrOut;
7576
}
76-
77+
7778
private static final double TOL = 1E-15;
78-
79+
7980
@Test
8081
public static void checkBounds() {
8182
int i = 0;
8283
for (int ci = 1; ci <= 3; ci++, i++) {
8384
double[] arr = runTestAux (20, ci, 1e-3);
8485
for (int j=0; j<5; j++) {
85-
assertTrue((arr[j] / std[i][j] -1.0) < TOL);
86+
assertTrue(((arr[j] / std[i][j]) -1.0) < TOL);
8687
}
8788
}
8889
for (int ci = 1; ci <= 3; ci++, i++) {
8990
double[] arr = runTestAux (200, ci, 1e-5);
9091
for (int j=0; j<5; j++) {
91-
assertTrue((arr[j] / std[i][j] -1.0) < TOL);
92+
assertTrue(((arr[j] / std[i][j]) -1.0) < TOL);
9293
}
9394
}
9495
//comment last one out for a shorter test
@@ -99,22 +100,22 @@ public static void checkBounds() {
99100
// }
100101
// }
101102
}
102-
103+
103104
// With all 3 enabled the test should produce in groups of 3 */
104105
private static final double[][] std = {
105106
{7.083330682531043e+04, 8.530373642825481e+04, 3.273647725073409e+04, 3.734024243699785e+04, 57750},
106107
{6.539415269641498e+04, 8.945522372568645e+04, 3.222302546497840e+04, 3.904738469737429e+04, 57750},
107108
{6.006043493107306e+04, 9.318105731423477e+04, 3.186269956585285e+04, 4.096466221922520e+04, 57750},
108-
109+
109110
{2.275584770163813e+06, 2.347586549014998e+06, 1.020399409477305e+06, 1.036729927598294e+06, 920982},
110111
{2.243569126699713e+06, 2.374663344107342e+06, 1.017017233582122e+06, 1.042597845553438e+06, 920982},
111112
{2.210056231903739e+06, 2.400441267999687e+06, 1.014081235946986e+06, 1.049480769755676e+06, 920982},
112-
113+
113114
{4.688240115809608e+07, 4.718067204619278e+07, 2.148362024482338e+07, 2.153118905212302e+07, 12834414},
114115
{4.674205938540214e+07, 4.731333757486791e+07, 2.146902141966406e+07, 2.154916650733873e+07, 12834414},
115116
{4.659896614422579e+07, 4.744404182094614e+07, 2.145525391547799e+07, 2.156815612325058e+07, 12834414}
116117
};
117-
118+
118119
@Test
119120
public static void checkCheckArgs() {
120121
try {
@@ -129,7 +130,7 @@ public static void checkCheckArgs() {
129130
//pass
130131
}
131132
}
132-
133+
133134
@Test
134135
public static void checkComputeApproxBino_LB_UB() {
135136
long n = 100;
@@ -143,12 +144,12 @@ public static void checkComputeApproxBino_LB_UB() {
143144
result = getUpperBound(n, theta, 1, true);
144145
assertEquals(result, 0.0, 0.0);
145146
}
146-
147+
147148
@Test(expectedExceptions = SketchesArgumentException.class)
148149
public static void checkThetaLimits1() {
149150
BinomialBoundsN.getUpperBound(100, 1.1, 1, false);
150151
}
151-
152+
152153
@Test
153154
public static void boundsExample() {
154155
println("BinomialBoundsN Example:");
@@ -164,17 +165,17 @@ public static void boundsExample() {
164165
println("LB: "+lb);
165166
println("");
166167
}
167-
168+
168169
@Test
169170
public void printlnTest() {
170171
println("PRINTING: "+this.getClass().getName());
171172
}
172-
173+
173174
/**
174-
* @param s value to print
175+
* @param s value to print
175176
*/
176177
static void println(String s) {
177178
//System.out.println(s); //disable here
178179
}
179-
180+
180181
}

src/test/java/com/yahoo/sketches/BoundsOnBinomialProportionsTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
/**
3434
* @author Kevin Lang
3535
*/
36+
@SuppressWarnings("javadoc")
3637
public class BoundsOnBinomialProportionsTest {
3738

3839
@Test
@@ -51,7 +52,7 @@ public static void tinyLBTest () {
5152
// System.out.printf ("LB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, lb);
5253
}
5354
}
54-
55+
5556
@Test
5657
public static void tinyUBTest () {
5758
// these answers were computed using a different programming language and therefore might not match exactly.
@@ -68,7 +69,7 @@ public static void tinyUBTest () {
6869
// System.out.printf ("UB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, ub);
6970
}
7071
}
71-
72+
7273
// This is for Kevin's use only, and will not be one of the unit tests.
7374
public static void lotsOfSpewage (long maxN) {
7475
for (long n = 0; n <= maxN; n++) {
@@ -113,7 +114,7 @@ public static void checkNumStdDevZero() {
113114
println("LB: "+lb);
114115
println("UB: "+ub);
115116
}
116-
117+
117118
@Test
118119
public static void checkInputs() {
119120
try {
@@ -139,24 +140,24 @@ public static void checkInputs() {
139140
}
140141
assertEquals(estimateUnknownP(0, 0), 0.5, 0.0);
141142
}
142-
143+
143144
@Test
144145
public static void checkErf() {
145146
assertTrue(erf(-2.0) < 0.99);
146147
assertTrue(erf(2.0) > 0.99);
147148
}
148-
149+
149150
@Test
150151
public void printlnTest() {
151152
println("PRINTING: "+this.getClass().getName());
152153
}
153-
154+
154155
/**
155-
* @param s value to print
156+
* @param s value to print
156157
*/
157158
static void println(String s) {
158159
//System.out.println(s); //disable here
159160
}
160-
161-
161+
162+
162163
}

src/test/java/com/yahoo/sketches/BoundsOnRatiosInSampledSetsTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import org.testng.annotations.Test;
3131

32+
@SuppressWarnings("javadoc")
3233
public class BoundsOnRatiosInSampledSetsTest {
3334

3435
@Test
@@ -37,31 +38,31 @@ public void checkNormalReturns() {
3738
getLowerBoundForBoverA(500, 100, 0.75);
3839
getLowerBoundForBoverA(500, 100, 1.0);
3940
assertEquals(getLowerBoundForBoverA(0, 0, .1), 0.0, 0.0);
40-
41+
4142
getUpperBoundForBoverA(500, 100, .1);
4243
getUpperBoundForBoverA(500, 100, 0.75);
4344
getUpperBoundForBoverA(500, 100, 1.0);
4445
assertEquals(getUpperBoundForBoverA(0, 0, .1), 1.0, 0.0);
45-
46+
4647
getEstimateOfBoverA(500,100);
4748
getEstimateOfA(500, .1);
4849
getEstimateOfB(100, .1);
4950
assertEquals(getEstimateOfBoverA(0, 0), .5, 0.0);
5051
}
51-
52+
5253
@Test(expectedExceptions = SketchesArgumentException.class)
5354
public void checkInputA() {
5455
checkInputs(-1, 0, .3);
5556
}
56-
57+
5758
@Test(expectedExceptions = SketchesArgumentException.class)
5859
public void checkInputB() {
5960
checkInputs(500, -1, .3);
6061
}
61-
62+
6263
@Test(expectedExceptions = SketchesArgumentException.class)
6364
public void checkInputF() {
6465
checkInputs(500, 100, -1);
6566
}
66-
67+
6768
}

src/test/java/com/yahoo/sketches/BoundsOnRatiosInThetaSketchedSetsTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.yahoo.sketches.theta.Sketches;
3030
import com.yahoo.sketches.theta.UpdateSketch;
3131

32+
@SuppressWarnings("javadoc")
3233
public class BoundsOnRatiosInThetaSketchedSetsTest {
3334

3435
@Test
@@ -38,7 +39,7 @@ public void checkNormalReturns() {
3839
int uA = 10000;
3940
int uC = 100000;
4041
for (int i=0; i<uA; i++) { skA.update(i); }
41-
for (int i=0; i<uC; i++) { skC.update(i+uA/2); }
42+
for (int i=0; i<uC; i++) { skC.update(i+(uA/2)); }
4243
Intersection inter = Sketches.setOperationBuilder().buildIntersection();
4344
inter.update(skA);
4445
inter.update(skC);
@@ -76,7 +77,7 @@ public void checkAbnormalReturns() {
7677
int uA = 100000;
7778
int uC = 10000;
7879
for (int i=0; i<uA; i++) { skA.update(i); }
79-
for (int i=0; i<uC; i++) { skC.update(i+uA/2); }
80+
for (int i=0; i<uC; i++) { skC.update(i+(uA/2)); }
8081
BoundsOnRatiosInThetaSketchedSets.getEstimateOfBoverA(skA, skC);
8182
}
8283

@@ -86,7 +87,7 @@ public void printlnTest() {
8687
}
8788

8889
/**
89-
* @param s value to print
90+
* @param s value to print
9091
*/
9192
static void println(String s) {
9293
//System.out.println(s); //disable here

src/test/java/com/yahoo/sketches/ByteArrayUtilTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
/**
4747
* @author Lee Rhodes
4848
*/
49+
@SuppressWarnings("javadoc")
4950
public class ByteArrayUtilTest {
5051

5152
@Test

src/test/java/com/yahoo/sketches/FamilyTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
/**
3030
* @author Lee Rhodes
3131
*/
32+
@SuppressWarnings("javadoc")
3233
public class FamilyTest {
3334

3435
@Test

0 commit comments

Comments
 (0)