From bc501e7966f2a870f1caea79500c67c79cd82dc7 Mon Sep 17 00:00:00 2001 From: Kristofer Karlsson Date: Wed, 9 Dec 2015 16:20:51 +0100 Subject: [PATCH] Fix bug where compiler can't figure out how to call FuturesExtra.join --- .../java/com/spotify/futures/CompletableFuturesExtra.java | 2 +- src/main/java/com/spotify/futures/FuturesExtra.java | 6 +++--- src/main/java/com/spotify/futures/JoinedResults.java | 6 +++--- .../java/com/spotify/futures/jdk7/JoinedResultsTest.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/spotify/futures/CompletableFuturesExtra.java b/src/main/java/com/spotify/futures/CompletableFuturesExtra.java index f75cd29..b4c8df2 100644 --- a/src/main/java/com/spotify/futures/CompletableFuturesExtra.java +++ b/src/main/java/com/spotify/futures/CompletableFuturesExtra.java @@ -142,7 +142,7 @@ public static CompletionStage exceptionallyCompose( * @param stage a {@link CompletionStage}. * @throws IllegalStateException if the stage is not completed. */ - public static void checkCompleted(CompletionStage stage) { + public static void checkCompleted(CompletionStage stage) { if (!stage.toCompletableFuture().isDone()) { throw new IllegalStateException("future was not completed"); } diff --git a/src/main/java/com/spotify/futures/FuturesExtra.java b/src/main/java/com/spotify/futures/FuturesExtra.java index dc86ecf..5b2dbc9 100644 --- a/src/main/java/com/spotify/futures/FuturesExtra.java +++ b/src/main/java/com/spotify/futures/FuturesExtra.java @@ -606,7 +606,7 @@ private static ListenableFuture transform(final List> * the join is accessed.

* @see #join(ListenableFuture...) */ - public static ListenableFuture join(List> inputs) { + public static ListenableFuture join(List> inputs) { return Futures.transform(Futures.allAsList(inputs), new JoinedResults.Transform(inputs)); } @@ -645,7 +645,7 @@ public static ListenableFuture asyncTransform( * @param future the future. * @throws IllegalStateException if the future is not completed. */ - public static void checkCompleted(ListenableFuture future) { + public static void checkCompleted(ListenableFuture future) { if (!future.isDone()) { throw new IllegalStateException("future was not completed"); } @@ -671,7 +671,7 @@ public static T getCompleted(ListenableFuture future) { * @return the exception of a future or null if no exception was thrown * @throws IllegalStateException if the future is not completed. */ - public static Throwable getException(ListenableFuture future) { + public static Throwable getException(ListenableFuture future) { checkCompleted(future); try { Uninterruptibles.getUninterruptibly(future); diff --git a/src/main/java/com/spotify/futures/JoinedResults.java b/src/main/java/com/spotify/futures/JoinedResults.java index 6c3d064..b1b772c 100644 --- a/src/main/java/com/spotify/futures/JoinedResults.java +++ b/src/main/java/com/spotify/futures/JoinedResults.java @@ -53,9 +53,9 @@ public T get(ListenableFuture future) { return t; } - static class Transform implements Function, JoinedResults> { - private final List> futures; - public Transform(List> list) { + static class Transform implements Function, JoinedResults> { + private final List> futures; + public Transform(List> list) { futures = ImmutableList.copyOf(list); } diff --git a/src/test/java/com/spotify/futures/jdk7/JoinedResultsTest.java b/src/test/java/com/spotify/futures/jdk7/JoinedResultsTest.java index 060a2bb..cc444ee 100644 --- a/src/test/java/com/spotify/futures/jdk7/JoinedResultsTest.java +++ b/src/test/java/com/spotify/futures/jdk7/JoinedResultsTest.java @@ -49,7 +49,7 @@ public void testMixedTypes() throws Exception { public void testWithList() throws Exception { ListenableFuture futureA = Futures.immediateFuture("a"); ListenableFuture futureB = Futures.immediateFuture("b"); - List> list = Arrays.>asList(futureA, futureB); + List> list = Arrays.asList(futureA, futureB); JoinedResults joined = FuturesExtra.join(list).get(); assertEquals("a", joined.get(futureA)); assertEquals("b", joined.get(futureB));