JDK 9 proposal: remove sun.misc.Ref

Joe Darcy joe.darcy at oracle.com
Tue Jan 7 22:26:00 UTC 2014


As part of the lint clean up of core libraries, I noticed a number of 
warnings in the class sun.misc.Ref. Notable excerpts from the file:

> /*
>  * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights 
> reserved.
> ...
>  * @deprecated This class has been replaced by
>  * <code>java.util.SoftReference</code>.
>  *
> ...
>  *
>  */
> @Deprecated
> public abstract class Ref {

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.



More information about the core-libs-dev mailing list