JDK 9 RFR of 8032397: Remove sun.misc.Ref
Alan.Bateman at oracle.com
Tue Jan 21 21:02:19 UTC 2014
On 21/01/2014 18:28, Joe Darcy wrote:
> Following up from an earlier discussion on core-libs , I've gone
> through the exercise of purging sun.misc.Ref from the JDK repo. Patch
> below (having difficulties uploading the webrev to cr.openjdk at the
> time of writing.)
> For the change associated with removing sun.misc.Ref, I was aiming to
> minimize the alteration of surrounding code.
> For sun.misc.Cache, the CacheEntry class that subclasses Ref before
> now instead has an internal SoftReference and a few short methods that
> Ref used to define.
> In the Applet area, since the functionality of sun.misc.Ref over and
> above SoftReference was being used, I copied and partially generified
> the sun.misc.Ref code into AppletImageRef. Semantically,
> AppletImageRef is now a sun.misc.Ref<Image>.
> The purge of Ref required removing a method from AppletResourceLoader,
> a class which looks like it should have long ago been deprecated.
> A clean build of the jdk repo works after sun.misc.Ref has been
> deleted. Before pushing the change, I'll do a jprt job to make sure
> there aren't any other stray uses of Ref.
I think this is okay, just took me a few seconds to see what had moved
from Ref (along with the javadoc comments). A minor comment is that
Cache has an @see sun.misc.Ref in its class description that should be
I searched the forest and I see there are two RMI tests that reference
it, one directly, the other seems to be just a comment.
I also see that jhat looks for sun.misc.Ref in the heap. I guess someone
could use a JDK 9 build and run jhat to look at a heap dump from a older
JDK where sun.misc.Ref is used so maybe there is an argument to leaving
this in. If you do then maybe it needs a comment.
More information about the core-libs-dev