3935 |
|
}} |
3936 |
|
|
3937 |
|
/** |
3938 |
< |
* Minimal completion stages throw UOE for all non-CompletionStage methods |
3938 |
> |
* Minimal completion stages throw UOE for most non-CompletionStage methods |
3939 |
|
*/ |
3940 |
|
public void testMinimalCompletionStage_minimality() { |
3941 |
|
if (!testImplementationDetails) return; |
3964 |
|
.filter((method) -> !permittedMethodSignatures.contains(toSignature.apply(method))) |
3965 |
|
.collect(Collectors.toList()); |
3966 |
|
|
3967 |
< |
CompletionStage<Integer> minimalStage = |
3968 |
< |
new CompletableFuture<Integer>().minimalCompletionStage(); |
3967 |
> |
List<CompletionStage<Integer>> stages = new ArrayList<>(); |
3968 |
> |
stages.add(new CompletableFuture<Integer>().minimalCompletionStage()); |
3969 |
> |
stages.add(CompletableFuture.completedStage(1)); |
3970 |
> |
stages.add(CompletableFuture.failedStage(new CFException())); |
3971 |
|
|
3972 |
|
List<Method> bugs = new ArrayList<>(); |
3973 |
|
for (Method method : allMethods) { |
3983 |
|
else if (parameterTypes[i] == long.class) |
3984 |
|
args[i] = 0L; |
3985 |
|
} |
3986 |
< |
try { |
3987 |
< |
method.invoke(minimalStage, args); |
3988 |
< |
bugs.add(method); |
3987 |
< |
} |
3988 |
< |
catch (java.lang.reflect.InvocationTargetException expected) { |
3989 |
< |
if (! (expected.getCause() instanceof UnsupportedOperationException)) { |
3986 |
> |
for (CompletionStage<Integer> stage : stages) { |
3987 |
> |
try { |
3988 |
> |
method.invoke(stage, args); |
3989 |
|
bugs.add(method); |
3991 |
– |
// expected.getCause().printStackTrace(); |
3990 |
|
} |
3991 |
+ |
catch (java.lang.reflect.InvocationTargetException expected) { |
3992 |
+ |
if (! (expected.getCause() instanceof UnsupportedOperationException)) { |
3993 |
+ |
bugs.add(method); |
3994 |
+ |
// expected.getCause().printStackTrace(); |
3995 |
+ |
} |
3996 |
+ |
} |
3997 |
+ |
catch (ReflectiveOperationException bad) { throw new Error(bad); } |
3998 |
|
} |
3994 |
– |
catch (ReflectiveOperationException bad) { throw new Error(bad); } |
3999 |
|
} |
4000 |
|
if (!bugs.isEmpty()) |
4001 |
< |
throw new Error("Methods did not throw UOE: " + bugs.toString()); |
4001 |
> |
throw new Error("Methods did not throw UOE: " + bugs); |
4002 |
|
} |
4003 |
|
|
4004 |
|
static class Monad { |