Skip to content

Commit 6a9d052

Browse files
Skezzowskijavadev
authored andcommitted
Resolve warnings.
1 parent da754b0 commit 6a9d052

File tree

12 files changed

+68
-190
lines changed

12 files changed

+68
-190
lines changed

src/main/java/com/github/underscore/U.java

Lines changed: 10 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/com/github/underscore/lodash/Json.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@ public static Object fromJson(String string) {
872872
return new JsonParser(string).parse();
873873
}
874874

875-
@SuppressWarnings("unchecked")
876875
public static String formatJson(String json, JsonStringBuilder.Step identStep) {
877876
Object result = fromJson(json);
878877
if (result instanceof Map) {

src/main/java/com/github/underscore/lodash/U.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ public Chain<T> uniq() {
332332
return new Chain<T>(U.uniq(value()));
333333
}
334334

335-
@SuppressWarnings("unchecked")
336335
public <F> Chain<T> uniq(final Function<T, F> func) {
337336
return new Chain<T>(U.newArrayList(U.uniq(value(), func)));
338337
}
@@ -346,17 +345,14 @@ public <F> Chain<F> distinctBy(final Function<T, F> func) {
346345
return new Chain<F>(U.newArrayList((Iterable<F>) U.uniq(value(), func)));
347346
}
348347

349-
@SuppressWarnings("unchecked")
350348
public Chain<T> union(final List<T> ... lists) {
351349
return new Chain<T>(U.union(value(), lists));
352350
}
353351

354-
@SuppressWarnings("unchecked")
355352
public Chain<T> intersection(final List<T> ... lists) {
356353
return new Chain<T>(U.intersection(value(), lists));
357354
}
358355

359-
@SuppressWarnings("unchecked")
360356
public Chain<T> difference(final List<T> ... lists) {
361357
return new Chain<T>(U.difference(value(), lists));
362358
}
@@ -401,7 +397,6 @@ public Chain<T> interposeByList(final Iterable<T> interIter) {
401397
return new Chain<T>(U.interposeByList(value(), interIter));
402398
}
403399

404-
@SuppressWarnings("unchecked")
405400
public Chain<T> concat(final List<T> ... lists) {
406401
return new Chain<T>(U.concat(value(), lists));
407402
}
@@ -683,7 +678,6 @@ public Chain<String> fetch(final String method, final String body) {
683678
return new Chain<String>(U.fetch((String) item(), method, body).text());
684679
}
685680

686-
@SuppressWarnings("unchecked")
687681
public Chain<List<T>> createPermutationWithRepetition(final int permutationLength) {
688682
return new Chain<List<T>>(U.createPermutationWithRepetition((List<T>) value(), permutationLength));
689683
}
@@ -717,7 +711,6 @@ public static <T> Chain<T> chain(final Iterable<T> iterable, int size) {
717711
return new U.Chain<T>(newArrayList(iterable, size));
718712
}
719713

720-
@SuppressWarnings("unchecked")
721714
public static <T> Chain<T> chain(final T ... list) {
722715
return new U.Chain<T>(Arrays.asList(list));
723716
}
@@ -1983,22 +1976,18 @@ private static List<Status> scanDirs(Queue<Status> queue, int success, List<Stat
19831976
return result;
19841977
}
19851978

1986-
@SuppressWarnings("unchecked")
19871979
public List<List<T>> createPermutationWithRepetition(final int permutationLength) {
19881980
return createPermutationWithRepetition((List<T>) value(), permutationLength);
19891981
}
19901982

1991-
@SuppressWarnings("unchecked")
19921983
protected static <T> List<T> newArrayList() {
19931984
return com.github.underscore.U.newArrayList();
19941985
}
19951986

1996-
@SuppressWarnings("unchecked")
19971987
protected static <T> List<T> newArrayList(final Iterable<T> iterable) {
19981988
return com.github.underscore.U.newArrayList(iterable);
19991989
}
20001990

2001-
@SuppressWarnings("unchecked")
20021991
protected static <T> Set<T> newLinkedHashSet() {
20031992
return com.github.underscore.U.newLinkedHashSet();
20041993
}
@@ -2079,7 +2068,6 @@ public Object fromXml() {
20792068
return Xml.fromXml(getString().get());
20802069
}
20812070

2082-
@SuppressWarnings("unchecked")
20832071
public static String jsonToXml(String json, Xml.XmlStringBuilder.Step identStep) {
20842072
Object result = Json.fromJson(json);
20852073
if (result instanceof Map) {
@@ -2092,7 +2080,6 @@ public static String jsonToXml(String json) {
20922080
return jsonToXml(json, Xml.XmlStringBuilder.Step.TWO_SPACES);
20932081
}
20942082

2095-
@SuppressWarnings("unchecked")
20962083
public static String xmlToJson(String xml, Json.JsonStringBuilder.Step identStep) {
20972084
Object result = Xml.fromXml(xml);
20982085
if (result instanceof Map) {

src/main/java/com/github/underscore/lodash/Xml.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,6 @@ private static Object stringToNumber(String number) {
998998
return localValue;
999999
}
10001000

1001-
@SuppressWarnings("unchecked")
10021001
private static Object createMap(final org.w3c.dom.Node node,
10031002
final BiFunction<Object, Set<String>, String> elementMapper,
10041003
final Function<Object, Object> nodeMapper, final Map<String, Object> attrMap,
@@ -1243,7 +1242,6 @@ private static void addNodeValue(final Map<String, Object> map, final String nam
12431242
}
12441243
}
12451244

1246-
@SuppressWarnings("unchecked")
12471245
private static void addText(final Map<String, Object> map, final String name, final List<Object> objects,
12481246
final Object value, final FromType fromType) {
12491247
int lastIndex = map.size() - 1;
@@ -1268,7 +1266,6 @@ private static void addText(final Map<String, Object> map, final String name, fi
12681266
}
12691267
}
12701268

1271-
@SuppressWarnings("unchecked")
12721269
public static Object fromXml(final String xml) {
12731270
return fromXml(xml, FromType.FOR_CONVERT);
12741271
}
@@ -1278,7 +1275,6 @@ public enum FromType {
12781275
FOR_FORMAT
12791276
}
12801277

1281-
@SuppressWarnings("unchecked")
12821278
public static Object fromXml(final String xml, final FromType fromType) {
12831279
if (xml == null) {
12841280
return null;
@@ -1462,7 +1458,6 @@ public String apply(Object object, Set<String> namespaces) {
14621458
});
14631459
}
14641460

1465-
@SuppressWarnings("unchecked")
14661461
public static String formatXml(String xml, XmlStringBuilder.Step identStep) {
14671462
Object result = fromXml(xml, FromType.FOR_FORMAT);
14681463
return toXml((Map) result, identStep);

src/test/java/com/github/underscore/ArraysTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ public boolean test(Integer item) {
258258
=> [3, 2, 1]
259259
*/
260260
@Test
261-
@SuppressWarnings("unchecked")
262261
public void rest() {
263262
final List<Integer> result = U.rest(asList(5, 4, 3, 2, 1));
264263
assertEquals("[4, 3, 2, 1]", result.toString());
@@ -772,7 +771,6 @@ public int compareTo(Person person) {
772771
=> [1, 2, 3, 4]
773772
*/
774773
@Test
775-
@SuppressWarnings("unchecked")
776774
public void uniq() {
777775
final List<Integer> result = U.uniq(asList(1, 2, 1, 3, 1, 4));
778776
assertEquals("[1, 2, 3, 4]", result.toString());
@@ -821,7 +819,6 @@ public String apply(Person person) {
821819
=> [1, 2, 3, 4]
822820
*/
823821
@Test
824-
@SuppressWarnings("unchecked")
825822
public void distinct() {
826823
final List<Integer> result = U.distinct(asList(1, 2, 1, 3, 1, 4));
827824
assertEquals("[1, 2, 3, 4]", result.toString());

src/test/java/com/github/underscore/ChainingTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public class ChainingTest {
5353
=> "moe is 21"
5454
*/
5555
@Test
56-
@SuppressWarnings("unchecked")
5756
public void chain() {
5857
final List<Map<String, Object>> stooges = new ArrayList<Map<String, Object>>() { {
5958
add(new LinkedHashMap<String, Object>() { { put("name", "curly"); put("age", 25); } });
@@ -78,7 +77,6 @@ public String apply(Map<String, Object> item) {
7877
}
7978

8079
@Test
81-
@SuppressWarnings("unchecked")
8280
public void chainSet() {
8381
final Set<Map<String, Object>> stooges = new HashSet<Map<String, Object>>() { {
8482
add(new LinkedHashMap<String, Object>() { { put("name", "curly"); put("age", 25); } });
@@ -128,7 +126,6 @@ public String apply(Map<String, Object> item) {
128126
}
129127

130128
@Test
131-
@SuppressWarnings("unchecked")
132129
public void chainArray() {
133130
final List<Map<String, Object>> stooges = new ArrayList<Map<String, Object>>() { {
134131
add(new LinkedHashMap<String, Object>() { { put("name", "curly"); put("age", 25); } });
@@ -293,7 +290,6 @@ public Map<String, Integer> apply(Map<String, Integer> accum, String item) {
293290
=> [{ doctorNumber: "#9", playedBy: "Christopher Eccleston", yearsPlayed: 1 }]
294291
*/
295292
@Test
296-
@SuppressWarnings("unchecked")
297293
public void chain4() {
298294
final List<Map<String, Object>> doctors = new ArrayList<Map<String, Object>>() { {
299295
add(new LinkedHashMap<String, Object>() { {
@@ -344,7 +340,6 @@ public Map<String, Object> apply(final Map<String, Object> item) {
344340
=> [{ number: 9, actor: "Christopher Eccleston", begin: 2005, end: 2005 }]
345341
*/
346342
@Test
347-
@SuppressWarnings("unchecked")
348343
public void chain5() {
349344
final List<Map<String, Object>> doctors = new ArrayList<Map<String, Object>>() { {
350345
add(new LinkedHashMap<String, Object>() { {
@@ -362,7 +357,6 @@ public void chain5() {
362357
}
363358

364359
@Test
365-
@SuppressWarnings("unchecked")
366360
public void chain6() {
367361
final List<Comparable> result = U.chain(U.chain(U.class.getDeclaredMethods())
368362
.reduce(new BiFunction<List<String>, Method, List<String>>() {
@@ -392,7 +386,6 @@ public boolean test(final String name) {
392386
=> 34
393387
*/
394388
@Test
395-
@SuppressWarnings("unchecked")
396389
public void chain7() {
397390
String[] words = new String[] {"Gallinule", "Escambio", "Aciform", "Entortilation", "Extensibility"};
398391
int sum = U.chain(words)
@@ -415,7 +408,6 @@ public Integer apply(Integer accum, Integer length) {
415408
}
416409

417410
@Test
418-
@SuppressWarnings("unchecked")
419411
public void chain8() {
420412
final List<Comparable> result = U.chain(U.class.getDeclaredMethods())
421413
.map(new Function<Method, String>() {
@@ -442,7 +434,6 @@ public Character apply(final String name) {
442434
}
443435

444436
@Test
445-
@SuppressWarnings("unchecked")
446437
public void chain9() {
447438
final List<Comparable> result = U.chain(U.chain(U.class.getDeclaredMethods())
448439
.reduce(new BiFunction<List<String>, Method, List<String>>() {

src/test/java/com/github/underscore/CollectionsTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ public List<Integer> apply(List<Integer> item1, List<Integer> item2) {
525525
=> 2
526526
*/
527527
@Test
528-
@SuppressWarnings("unchecked")
529528
public void find() {
530529
final Optional<Integer> result = U.find(asList(1, 2, 3, 4, 5, 6),
531530
new Predicate<Integer>() {
@@ -555,7 +554,6 @@ public boolean test(Integer item) {
555554
=> 6
556555
*/
557556
@Test
558-
@SuppressWarnings("unchecked")
559557
public void findLast() {
560558
final Optional<Integer> result = U.findLast(asList(1, 2, 3, 4, 5, 6),
561559
new Predicate<Integer>() {
@@ -1347,7 +1345,6 @@ public String toString() {
13471345
=> 1000
13481346
*/
13491347
@Test
1350-
@SuppressWarnings("unchecked")
13511348
public void max() {
13521349
final Integer result = U.max(asList(10, 5, 100, 2, 1000));
13531350
assertEquals("1000", result.toString());
@@ -1401,7 +1398,6 @@ public Integer apply(Person item) {
14011398
=> 2
14021399
*/
14031400
@Test
1404-
@SuppressWarnings("unchecked")
14051401
public void min() {
14061402
final Integer result = U.min(asList(10, 5, 100, 2, 1000));
14071403
assertEquals("2", result.toString());
@@ -1734,7 +1730,6 @@ public void shuffle() {
17341730
=> [1, 6, 2]
17351731
*/
17361732
@Test
1737-
@SuppressWarnings("unchecked")
17381733
public void sample() {
17391734
final Integer result = U.sample(asList(1, 2, 3, 4, 5, 6));
17401735
assertTrue(result >= 1 && result <= 6);

src/test/java/com/github/underscore/ObjectsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ public void isError() {
378378
=> [4, 40000]
379379
*/
380380
@Test
381-
@SuppressWarnings("unchecked")
382381
public void tap() {
383382
final List<Map.Entry<String, Integer>> result = new ArrayList<Map.Entry<String, Integer>>();
384383
U.tap((new LinkedHashMap<String, Integer>() { { put("a", 1); put("b", 2); put("c", 3); } }).entrySet(),

src/test/java/com/github/underscore/UnderscoreTest.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ public void copyOf() {
259259
_.elementAt(arr, 1) // => 2
260260
*/
261261
@Test
262-
@SuppressWarnings("unchecked")
263262
public void elementAt() {
264263
assertEquals(2, U.<Integer>elementAt(asList(1, 2, 3), 1).intValue());
265264
assertEquals(2, new U<Integer>(asList(1, 2, 3)).elementAt(1).intValue());
@@ -270,7 +269,6 @@ public void elementAt() {
270269
_.get(arr, 1) // => 2
271270
*/
272271
@Test
273-
@SuppressWarnings("unchecked")
274272
public void get() {
275273
assertEquals(2, U.<Integer>get(asList(1, 2, 3), 1).intValue());
276274
assertEquals(2, new U<Integer>(asList(1, 2, 3)).get(1).intValue());
@@ -281,7 +279,6 @@ public void get() {
281279
_.set(arr, 1, 100) // => 2
282280
*/
283281
@Test
284-
@SuppressWarnings("unchecked")
285282
public void set() {
286283
Tuple<Integer, List<Integer>> result = U.<Integer>set(asList(1, 2, 3), 1, 100);
287284
assertEquals(2, result.fst().intValue());
@@ -306,7 +303,6 @@ public void elementAtOutOfBounds() {
306303
_.elementAtOrElse(arr, 3, 0) // => 0
307304
*/
308305
@Test
309-
@SuppressWarnings("unchecked")
310306
public void elementAtOrElse() {
311307
assertEquals(2, U.<Integer>elementAtOrElse(asList(1, 2, 3), 1, 0).intValue());
312308
assertEquals(2, new U<Integer>(asList(1, 2, 3)).elementAtOrElse(1, 0).intValue());
@@ -320,7 +316,6 @@ public void elementAtOrElse() {
320316
_.elementAtOrNull(arr, 3) // => null
321317
*/
322318
@Test
323-
@SuppressWarnings("unchecked")
324319
public void elementAtOrNull() {
325320
assertEquals(2, U.<Integer>elementAtOrNull(asList(1, 2, 3), 1).intValue());
326321
assertEquals(2, new U<Integer>(asList(1, 2, 3)).elementAtOrNull(1).intValue());
@@ -342,7 +337,6 @@ public void reverse() {
342337
}
343338

344339
@Test
345-
@SuppressWarnings("unchecked")
346340
public void findLastWithCustomIterable() {
347341
final int[] array = new int[] {1, 2, 3, 4, 5, 6};
348342
Iterable<Integer> iterable = new Iterable<Integer>() {
@@ -411,6 +405,7 @@ public void remove() {
411405
}
412406

413407
@Test
408+
@SuppressWarnings("unlikely-arg-type")
414409
public void optional() {
415410
assertTrue(Optional.absent().equals(Optional.absent()));
416411
assertTrue(Optional.of(1).equals(Optional.of(1)));
@@ -578,7 +573,6 @@ public boolean test(Integer value) {
578573
}
579574

580575
@Test
581-
@SuppressWarnings("unchecked")
582576
public void stackoverflow() {
583577
// http://stackoverflow.com/questions/109383/how-to-sort-a-mapkey-value-on-the-values-in-java?rq=1
584578
assertEquals("{D=67.3, B=67.4, C=67.4, A=99.5}", U.chain((new LinkedHashMap<String, Double>() { {
@@ -594,7 +588,6 @@ public Double apply(Map.Entry<String, Double> item) {
594588
}
595589

596590
@Test
597-
@SuppressWarnings("unchecked")
598591
public void stackoverflow2() {
599592
// http://stackoverflow.com/questions/12229577/java-hashmap-sorting-string-integer-how-to-sort-it?lq=1
600593
assertEquals("{a=5, f=5, c=4, e=3, b=2, d=2}", U.chain((new LinkedHashMap<String, Integer>() { {
@@ -612,7 +605,6 @@ public Integer apply(Map.Entry<String, Integer> item) {
612605
}
613606

614607
@Test
615-
@SuppressWarnings("unchecked")
616608
public void stackoverflow3() {
617609
// http://stackoverflow.com/questions/11647889/sorting-the-mapkey-value-in-descending-order-based-on-the-value?lq=1
618610
assertEquals("{C=50, A=34, B=25}", U.chain((new LinkedHashMap<String, Integer>() { {
@@ -662,7 +654,6 @@ public void stackoverflow5() {
662654
}
663655

664656
@Test
665-
@SuppressWarnings("unchecked")
666657
public void jobtest() {
667658
String[] strings = {
668659
"Sound boy proceed to blast into the galaxy",

0 commit comments

Comments
 (0)