JDK 9 RFR of 8032397: Remove sun.misc.Ref
joe.darcy at oracle.com
Wed Jan 22 01:17:06 UTC 2014
Updated webrev at
@see in sun.misc.Ref removed.
Regression tests updated to not refer to sun.misc.Ref.
I looked at the use of Ref in jhat and it is only used if
java.lang.ref.Reference is not found reflectively, so I think the
existing code can stay in place.
On 01/21/2014 01:47 PM, Joe Darcy wrote:
> Hi Alan,
> On 01/21/2014 01:02 PM, Alan Bateman wrote:
>> 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 removed.
> I'll remove that in the next iteration of the webrev.
>> 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'll try those down and make the necessary updates.
>> 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.
> I'd prefer to remove sun.misc.Ref now and if it is a severe problem,
> restore it later in JDK 9.
> Thanks for the review,
More information about the core-libs-dev