Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Below lists some of the JDK internal APIs and the recommended way to replace their usage.

ComponentUnsupported API (not for use)Supported APIs (please use instead)Note
java.awt.peer and java.awt.dnd.peerTBD (JDK-8037739)The AWT Peer API has been unsupported API and java.awt.peer.ComponentPeer interface depends on sun.* internal API.
core-libssun.sun.iojava.nio.charsets @since 1.4 
 

sun.misc.BASE64Decoder, sun.misc.BASE64Encoder,
com.sun.org.apache.xml.internal.security.utils.Base64

java.util.Base64 @since 8See http://openjdk.java.net/jeps/135
 sun.misc.ClassLoaderUtiljava.net.URLClassLoader.close() @since 7 
 sun.misc.Cleanerjava.lang.ref.PhantomReference @since 1.2 
 sun.misc.Servicejava.util.ServiceLoader @since 1.6 
 sun.misc.Timerjava.util.Timer @since 1.3 
 sun.misc.Unsafesun.misc.Unsafe consists of a number of use cases.  The following features are identified to provide support in the future releases:

 

 
 TBDA JEP will be submitted to define a supported APIsun.reflect.Reflection.getCallerClassTBDA JEP will be submitted to define a supported API
security-libssun.security.action.*

java.security.PrivilegedAction to call System.getProperty or other action @since 1.1

AccessController.doPrivileged(
(PrivilegedAction<String>) () -> System.getProperty(key));
 sun.security.krb5.*Some provided in com.sun.security.jgssIf internal classes are used to get the session key of Krb5Context, we now have ExtendedGSSContext for this purpose. There are still many more functions not available yet.
 sun.security.util.SecurityConstants

java.lang.RuntimePermission, java.net.NetPermission, or specific Permission class @since 1.1

 
 sun.security.x509.X500Namejavax.security.auth.x500.X500Principal @since 1.4 

com.sun.image.codec.jpeg.**

sun.awt.image.codec

javax.imageio @since 1.4See JDK-6527962
 com.sun.org.apache.xml.internal.securityjavax.xml.crypto @since 1.6 
 

com.sun.net.ssl.**

javax.net.ssl @since 1.4 
 

security provider implementation class such as

  • com.sun.net.ssl.internal.ssl.Provider
  • sun.security.provider.Sun

java.security.Security.getProvider("SUN") @sine 1.3

In general, you should avoid depending on a specific provider as it may not be available on other Java implementations. See Oracle security providers documentation for more rationale.
 sun.security.provider.PolicyFile() or sun.security.provider.PolicyFile(URL)

java.security.Policy.getInstance("JavaPolicy", new java.security.URIParameter(uri)); @since 1.6

 
client-libsjava.awt.peer and java.awt.dnd.peerTBD (JDK-8037739)The AWT Peer API has been unsupported API and java.awt.peer.ComponentPeer interface depends on sun.* internal API.
 

com.sun.image.codec.jpeg.**

sun.awt.image.codec

javax.imageio @since 1.4See JDK-6527962
    
jdbccom.sun.rowset.**javax.sql.rowset.RowSetProvider @since 7 
compilercom.sun.tools.javac.**

javax.tools, javax.lang.model @since 1.6 com.sun.source

com.sun.tools.javac.Main is a supported API.