JDK 9 RFR of 8032397: Remove sun.misc.Ref

Joe Darcy joe.darcy at oracle.com
Tue Jan 21 21:47:00 UTC 2014


Hi Alan,

On 01/21/2014 01:02 PM, Alan Bateman wrote:
> On 21/01/2014 18:28, Joe Darcy wrote:
>> Hello,
>>
>> Following up from an earlier discussion on core-libs [1], 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.
>>
>> Thanks,
>>
>> -Joe
> 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,

-Joe




More information about the core-libs-dev mailing list