[jmm-dev] Non-core-model issues status

Doug Lea dl at cs.oswego.edu
Sat Sep 6 12:04:54 UTC 2014


On 09/02/2014 05:07 PM, Hans Boehm wrote:

>  > 2. We introduce and spec a reachabilityFence(Object x) method, and add
>  > wording about it in JLS sec 12.6. Further suggestions for doing more
>  > are still welcome. (Also, the method name is still up for grabs.
>  > Except that the name "keepAlive" is known to be too confusing
>  > to consider.)
> I thought we were focusing primarily on an annotation to declare fields that are
> cleaned up by finalizers, so that accessing such fields inhibits elimination of
> "dead" references.  I continue to believe that an API call by itself will not
> fix the problem.
>

Sorry for not being very consistent about this.
The more I look into the practical problems people face using
finalize, the less I believe that we can do anything that would
lead anyone to ever recommend that people use it outside of a few
niche contexts that already require lots of care and almost
always involve synchronization patterns that avoid need for
reachabilityFence/keepAlive. Still, reliance on coincidental
properties of synchronize(x) seems like a too big of a flaw not
to fix.

See for example the core-libs-dev discussion going on among
JDK and other library developers. Including:
http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-September/028479.html
and follow-ups.

-Doug



More information about the jmm-dev mailing list