A DESCRIPTION OF THE PROBLEM :
The code in the javadocs mentions
r instanceof Future<?>
and
result = ((Future<?>) r).get()
The Future there should be changed to FutureTask. r is a Runnable and Future doesn't implement Runnable but FutureTask does and is mentioned in the javadocs about the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
r instanceof FutureTask<?>
and
result = ((FutureTask<?>) r).get()
ACTUAL -
r instanceof Future<?>
and
result = ((Future<?>) r).get()
URL OF FAULTY DOCUMENTATION :
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html#afterExecute-java.lang.Runnable-java.lang.Throwable-
The code in the javadocs mentions
r instanceof Future<?>
and
result = ((Future<?>) r).get()
The Future there should be changed to FutureTask. r is a Runnable and Future doesn't implement Runnable but FutureTask does and is mentioned in the javadocs about the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
r instanceof FutureTask<?>
and
result = ((FutureTask<?>) r).get()
ACTUAL -
r instanceof Future<?>
and
result = ((Future<?>) r).get()
URL OF FAULTY DOCUMENTATION :
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html#afterExecute-java.lang.Runnable-java.lang.Throwable-