RFR: jsr166 jdk9 integration wave 2

Doug Lea dl at cs.oswego.edu
Tue Nov 17 12:01:39 UTC 2015

On 11/17/2015 05:16 AM, Paul Sandoz wrote:

> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
> CCC created.

Thanks, although it is just a clarification that makes
ForkJoinWorkerThreadFactory spec more similar to ThreadFactory.

> src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
>   398         private final void valueCheck(V v) {
>   399             if (v != null && !(vclass.isInstance(v)))
>   400                 throwCCE();
>   401         }
> Why not directly use vclass.cast ?

Only to preserve the exact exception thrown. Class.cast adds a detail message
to the ClassCastException that can be deceptive in...

> I think there may be a subtle change in behaviour with the updates to A*FU, where previously a CCE would be thrown and now a IAE is thrown e.g. consider an erased A*FU to a public field of some class and and a receiver of the incorrect type is passed to an access method. Does not really matter in practice, although the error message will be confusing.

We added more tck tests to check this, and all pass.
ClassCastException was/is thrown in two cases, without distinguishing them,
which allowed a path merge by arranging that "cclass" is now the same as 
"vclass" unless field is protected.


More information about the core-libs-dev mailing list