Commit 1d60cd0
committed
Make toJava(scalaFuture).toCF.obtrude* unsupported
The status quo was to allow the wrapper and the wrapped to diverge;
the as shown by:
```
@test
public void testToJavaToCompletableFutureJavaObtrudeCalledAfterScalaComplete() throws Exception {
final Promise<String> p = promise();
Future<String> sf = p.future();
final CompletionStage<String> cs = toJava(sf);
CompletableFuture<String> cf = cs.toCompletableFuture();
assertEquals("notyet", cf.getNow("notyet"));
p.success("scaladone");
assertEquals("scaladone", cf.get());
cf.obtrudeValue("javadone");
assertEquals("javadone", cf.get());
// obtrude does not mutate the underlying Scala future
assertEquals("scaladone", Await.result(sf, Duration.Inf()));
}
```
This commit throws an UOE, preferring to fail fast.1 parent 385de85 commit 1d60cd0
File tree
2 files changed
+25
-3
lines changed- src
- main/scala/scala/concurrent/java8
- test/java/scala/compat/java8
2 files changed
+25
-3
lines changedLines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
381 | 401 | | |
0 commit comments