JDK 9 proposal: remove sun.misc.Ref

Mandy Chung mandy.chung at oracle.com
Wed Jan 8 22:09:42 UTC 2014


On 1/8/2014 1:06 AM, Alan Bateman wrote:
> On 07/01/2014 22:26, Joe Darcy wrote:
>>
>> So the type has been deprecated for at least 10 years. Rather than 
>> fixing the warning in the class, I think the best course of action is 
>> to remove the file in JDK 9. A build of OpenJDK without this file 
>> builds fine; if a build of the closed sources goes fine to, I think 
>> that should be sufficient justification for this type to be removed.
>>
>> Using code search engines, there are just a handful of references to 
>> sun.misc.Ref in the wihld, but any such uses will have several years 
>> to migrate to the standard java.util.SoftReference before JDK 9 ships.
>>
>> Comments?
> See also JDK-6852936 [1] for other candidates to remove. We've always 
> been a bit hesitant to remove sun.misc classes out of concern as to 
> what/who it might break.
>
> As regards sun.misc.Ref then it would be good to remove it but I think 
> the appletviewer code needs to be checked first as it does appear to 
> be using it.

I also think it's good to remove sun.misc.Ref and existing usages should 
be replaced with java.lang.ref.SoftReference where appropriate.   In 
addition to appletviewer code using it, sun.misc.Cache extends 
sun.misc.Ref that will need to be updated which should be easy.

Mandy



More information about the core-libs-dev mailing list