Skip to content

Commit 946e300

Browse files
committed
Debug info if can't find cancellation method
1 parent 841e02d commit 946e300

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/net/tascalate/concurrent/core/CancelMethodsCache.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public static Cancellation cancellationOf(Class<?> stageClass) {
4343
}
4444

4545
private static final Cache<Class<?>, Cancellation> CANCEL_METHODS = new Cache<>();
46-
private static final Cancellation NO_CANCELATION = (p, b) -> false;
46+
private static final Cancellation NO_CANCELATION = (p, b) -> {
47+
System.err.println("Cancellation is not supported for promise " + p);
48+
return false;
49+
};
4750
private static final Function<Class<?>, Cancellation> LOOKUP_CANCEL_METHOD = c -> {
4851
Stream<Function<Class<?>, ExceptionalCancellation>> options = Stream.of(
4952
CancelMethodsCache::cancelInterruptibleMethodOf,
@@ -115,6 +118,7 @@ private static Method firstUnreflectableMethod(Class<?> clazz, Method m, Set<Cla
115118
if ((parent.getModifiers() & Modifier.PUBLIC) != 0) {
116119
return parent;
117120
} else {
121+
// Visibility can't be reduced, so no need to check superclasses
118122
return null;
119123
}
120124
} catch (NoSuchMethodException ex) {

0 commit comments

Comments
 (0)