| 85 | } |
| 86 | |
| 87 | private static class Empty<T> implements CombinedBuilder<T> { |
| 88 | |
| 89 | private int ix; |
| 90 | |
| 91 | @Override |
| 92 | public void add(CompletableFuture<T> completableFuture) { |
| 93 | this.ix++; |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public void addObject(Object object) { |
| 98 | this.ix++; |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | public CompletableFuture<List<T>> await() { |
| 103 | assertTrue(ix == 0, "expected size was 0 got %d", ix); |
| 104 | return typedEmpty(); |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public Object awaitPolymorphic() { |
| 109 | Assert.assertTrue(ix == 0, () -> "expected size was " + 0 + " got " + ix); |
| 110 | return Collections.emptyList(); |
| 111 | } |
| 112 | |
| 113 | // implementation details: infer the type of Completable<List<T>> from a singleton empty |
| 114 | private static final CompletableFuture<List<?>> EMPTY = CompletableFuture.completedFuture(Collections.emptyList()); |
| 115 | |
| 116 | @SuppressWarnings("unchecked") |
| 117 | private static <T> CompletableFuture<T> typedEmpty() { |
| 118 | return (CompletableFuture<T>) EMPTY; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | private static class Single<T> implements CombinedBuilder<T> { |
| 123 |
nothing calls this directly
no test coverage detected
searching dependent graphs…