summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@zancanaro.id.au>2015-07-06 23:47:20 +1000
committerCarlo Zancanaro <carlo@zancanaro.id.au>2015-07-06 23:47:20 +1000
commit47313d5a766bf970095228c1b577244f7fc55415 (patch)
treed713b3a3d4655d1d07305ad6146642ba627a76a6 /src
parenta7b074875f241d98877de51a93717d56cf2d19e4 (diff)
Fix up some minor code-quality things
Diffstat (limited to 'src')
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java12
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/junit/Properties.java2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java b/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java
index ddef800..9c51a7e 100644
--- a/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java
+++ b/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java
@@ -56,20 +56,22 @@ public class ShrinkTree<T> {
public static <T> Stream<ShrinkTree<T>[]> promoteChildren(ShrinkTree<? super T>[] trees) {
return IntStream.range(0, trees.length)
.mapToObj(index -> trees[index].getChildren().map(child ->
- (ShrinkTree<T>[]) IntStream.range(0, trees.length)
+ IntStream.range(0, trees.length)
.mapToObj(i -> (i == index ? child : trees[i]))
- .toArray(ShrinkTree[]::new)))
- .flatMap(x -> x);
+ .toArray(ShrinkTree<?>[]::new)))
+ .flatMap(x -> x)
+ .map(x -> (ShrinkTree<T>[]) x);
}
@SuppressWarnings("unchecked")
public static <T> Stream<ShrinkTree<T>[]> removeChildren(ShrinkTree<? super T>[] trees) {
return IntStream.range(0, trees.length)
.mapToObj(index ->
- (ShrinkTree<T>[]) IntStream.range(0, trees.length)
+ IntStream.range(0, trees.length)
.filter(i -> i != index)
.mapToObj(i -> trees[i])
- .toArray(ShrinkTree[]::new));
+ .toArray(ShrinkTree<?>[]::new))
+ .map(x -> (ShrinkTree<T>[]) x);
}
public static <T> Stream<ShrinkTree<T>[]> removeAndPromoteChildren(ShrinkTree<? super T>[] trees) {
diff --git a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java
index 175cd6c..9e6414a 100644
--- a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java
+++ b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java
@@ -85,7 +85,7 @@ public class Properties extends BlockJUnit4ClassRunner {
} else {
Generator<?>[] generators = Arrays.stream(method.getGenericParameterTypes())
.map(param -> provider.getGenerator(param, new Annotation[0], provider))
- .toArray(Generator[]::new);
+ .toArray(Generator<?>[]::new);
Generator<List<Object>> generator = Generator.tuple(generators);
long seed = getSeed(method);