Top For Removal Deprecated
OpenJDK 1.22

Deprecated API


Terminally Deprecated Item Summary

SinceTerminally Deprecated Item and Description
13
com.sun.java.swing.plaf.motif.MotifLookAndFeel

The Motif Look and Feel is deprecated with the intent to remove it in some future release. It is recommended to use javax.swing.plaf.metal.MetalLookAndFeel instead.

16
21
com.sun.nio.file.SensitivityWatchEventModifier

The sensitivity levels were historically used by polling-based WatchService implementations to configure the polling interval. They are are no longer used. The WatchService implementations in the JDK ignore these WatchEvent modifiers if they are specified when registering a directory to be watched.

16
9
java.applet.Applet

The Applet API is deprecated, no replacement.

9
java.applet.AppletContext

The Applet API is deprecated, no replacement.

9
java.applet.AppletStub

The Applet API is deprecated, no replacement.

9
java.applet.AudioClip

The Applet API is deprecated, no replacement.

9
java.awt.Graphics.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
java.awt.PrintJob.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
java.beans.AppletInitializer

The Applet API is deprecated. See the java.applet package documentation for further information.

9

Returns:

a JavaBean
java.beans.Beans.instantiate
(ClassLoader
the class-loader from which we should create the bean. If this is null, then the system class-loader is used.
cls
,
String
the name of the bean within the class-loader. For example "sun.beanbox.foobah"
beanName
,
BeanContext
The BeanContext in which to nest the new bean
beanContext
,
AppletInitializer
The AppletInitializer for the new bean
initializer
)

It is recommended to use instantiate(ClassLoader, String, BeanContext), because the Applet API is deprecated. See the java.applet package documentation for further information.

9
9
9
java.lang.Boolean(boolean
the value of the Boolean.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(boolean) is generally a better choice, as it is likely to yield significantly better space and time performance. Also consider using the final fields TRUE and FALSE if possible.

9
java.lang.Boolean(String
the string to be converted to a Boolean.
s
)

It is rarely appropriate to use this constructor. Use parseBoolean(String) to convert a string to a boolean primitive, or use valueOf(String) to convert a string to a Boolean object.

9
java.lang.Byte(byte
the value to be represented by the Byte.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(byte) is generally a better choice, as it is likely to yield significantly better space and time performance.

9
java.lang.Byte(String
the String to be converted to a Byte
s
)

It is rarely appropriate to use this constructor. Use parseByte(String) to convert a string to a byte primitive, or use valueOf(String) to convert a string to a Byte object.

9
java.lang.Character(char
the value to be represented by the Character object.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(char) is generally a better choice, as it is likely to yield significantly better space and time performance.

9
java.lang.Double(double
the value to be represented by the Double.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(double) is generally a better choice, as it is likely to yield significantly better space and time performance.

9
java.lang.Double(String
a string to be converted to a Double.
s
)

It is rarely appropriate to use this constructor. Use parseDouble(String) to convert a string to a double primitive, or use valueOf(String) to convert a string to a Double object.

18
java.lang.Enum.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
java.lang.Float(float
the value to be represented by the Float.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(float) is generally a better choice, as it is likely to yield significantly better space and time performance.

9
java.lang.Float(double
the value to be represented by the Float.
value
)

It is rarely appropriate to use this constructor. Instead, use the static factory method valueOf(float) method as follows: Float.valueOf((float)value).

9
java.lang.Float(String
a string to be converted to a Float.
s
)

It is rarely appropriate to use this constructor. Use parseFloat(String) to convert a string to a float primitive, or use valueOf(String) to convert a string to a Float object.

9
java.lang.Integer(int
the value to be represented by the Integer object.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(int) is generally a better choice, as it is likely to yield significantly better space and time performance.

9
java.lang.Integer(String
the String to be converted to an Integer.
s
)

It is rarely appropriate to use this constructor. Use parseInt(String) to convert a string to a int primitive, or use valueOf(String) to convert a string to an Integer object.

9
java.lang.Long(long
the value to be represented by the Long object.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(long) is generally a better choice, as it is likely to yield significantly better space and time performance.

9
java.lang.Long(String
the String to be converted to a Long.
s
)

It is rarely appropriate to use this constructor. Use parseLong(String) to convert a string to a long primitive, or use valueOf(String) to convert a string to a Long object.

9
java.lang.Object.finalize()

Finalization is deprecated and subject to removal in a future release. The use of finalization can lead to problems with security, performance, and reliability. See JEP 421 for discussion and alternatives.

Subclasses that override finalize to perform cleanup should use alternative cleanup mechanisms and remove the finalize method. Use java.lang.ref.Cleaner and java.lang.ref.PhantomReference as safer ways to release resources when an object becomes unreachable. Alternatively, add a close method to explicitly release resources, and implement AutoCloseable to enable use of the try-with-resources statement.

This method will remain in place until finalizers have been removed from most existing code.

18
java.lang.Runtime.runFinalization()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

When running in a JVM in which finalization has been disabled or removed, no objects will be pending finalization, so this method does nothing.

17
java.lang.SecurityManager

The Security Manager is deprecated and subject to removal in a future release. There is no replacement for the Security Manager. See JEP 411 for discussion and alternatives.

1.4
java.lang.SecurityManager.checkMulticast(InetAddress
Internet group address to be used.
maddr
,
byte
value in use, if it is multicast send.

Note

this particular implementation does not use the ttl parameter.

ttl
)

9
java.lang.Short(short
the value to be represented by the Short.
value
)

It is rarely appropriate to use this constructor. The static factory valueOf(short) is generally a better choice, as it is likely to yield significantly better space and time performance.

9
java.lang.Short(String
the String to be converted to a Short
s
)

It is rarely appropriate to use this constructor. Use parseShort(String) to convert a string to a short primitive, or use valueOf(String) to convert a string to a Short object.

17

Returns:

if a security manager has already been established for the current application, then that security manager is returned; otherwise, null is returned.
java.lang.System.getSecurityManager
()

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

18
java.lang.System.runFinalization()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

When running in a JVM in which finalization has been disabled or removed, no objects will be pending finalization, so this method does nothing.

17
java.lang.System.setSecurityManager(SecurityManager
the security manager or null
sm
)

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

17
java.lang.Thread.checkAccess()

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

1.2
java.lang.Thread.resume()

This method was originally specified to resume a thread suspended with suspend(). Suspending a thread was inherently deadlock-prone. For more information, see Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

1.2
java.lang.Thread.stop()

This method was originally specified to "stop" a victim thread by causing the victim thread to throw a ThreadDeath. It was inherently unsafe. Stopping a thread caused it to unlock all of the monitors that it had locked (as a natural consequence of the ThreadDeath exception propagating up the stack). If any of the objects previously protected by these monitors were in an inconsistent state, the damaged objects became visible to other threads, potentially resulting in arbitrary behavior. Usages of stop should be replaced by code that simply modifies some variable to indicate that the target thread should stop running. The target thread should check this variable regularly, and return from its run method in an orderly fashion if the variable indicates that it is to stop running. If the target thread waits for long periods (on a condition variable, for example), the interrupt method should be used to interrupt the wait. For more information, see Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

1.2
java.lang.Thread.suspend()

This method was originally specified to suspend a thread. It was inherently deadlock-prone. If the target thread held a lock on a monitor protecting a critical system resource when it was suspended, no thread could access the resource until the target thread was resumed. If the thread intending to resume the target thread attempted to lock the monitor prior to calling resume, deadlock would result. Such deadlocks typically manifested themselves as "frozen" processes. For more information, see Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

20
java.lang.ThreadDeath

Thread#stop() was originally specified to "stop" a victim thread by causing the victim thread to throw a ThreadDeath. It was inherently unsafe and deprecated in an early JDK release. The ability to "stop" a thread with Thread.stop has been removed and the Thread.stop method changed to throw an exception. Consequently, ThreadDeath is also deprecated, for removal.

17
java.lang.ThreadGroup.checkAccess()

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

16
java.lang.ThreadGroup.destroy()

This method was originally specified to destroy an empty thread group. The ability to explicitly destroy a thread group no longer exists. A thread group is eligible to be GC'ed when there are no live threads in the group and it is otherwise unreachable.

16

Returns:

the daemon status of this thread group
java.lang.ThreadGroup.isDaemon
()

This method originally indicated if the thread group is a daemon thread group that is automatically destroyed when its last thread terminates. The concept of daemon thread group no longer exists. A thread group is eligible to be GC'ed when there are no live threads in the group and it is otherwise unreachable.

16

Returns:

false
java.lang.ThreadGroup.isDestroyed
()

This method originally indicated if the thread group is destroyed. The ability to destroy a thread group and the concept of a destroyed thread group no longer exists. A thread group is eligible to be GC'ed when there are no live threads in the group and it is otherwise unreachable.

1.2
java.lang.ThreadGroup.resume()

This method was originally specified to resume all threads in the thread group.

16
java.lang.ThreadGroup.setDaemon(boolean
the daemon status
daemon
)

This method originally configured whether the thread group is a daemon thread group that is automatically destroyed when its last thread terminates. The concept of daemon thread group no longer exists. A thread group is eligible to be GC'ed when there are no live threads in the group and it is otherwise unreachable.

1.2
java.lang.ThreadGroup.stop()

This method was originally specified to stop all threads in the thread group. It was inherently unsafe.

1.2
java.lang.ThreadGroup.suspend()

This method was originally specified to suspend all threads in the thread group.

1.8
java.rmi.RMISecurityManager

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

17
java.security.AccessControlContext

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

17
java.security.AccessControlException

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

17
java.security.AccessController

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

1.2
java.security.Certificate

This class is deprecated and subject to removal in a future version of Java SE. It has been replaced by java.security.cert.Certificate and related classes.

17
java.security.DomainCombiner

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

1.2
java.security.Identity

This class is deprecated and subject to removal in a future version of Java SE. It has been replaced by java.security.KeyStore, the java.security.cert package, and java.security.Principal.

1.2
java.security.IdentityScope

This class is deprecated and subject to removal in a future version of Java SE. It has been replaced by java.security.KeyStore, the java.security.cert package, and java.security.Principal.

17
java.security.Policy

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

17
java.security.Policy.Parameters

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

17
java.security.PolicySpi

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

1.2
java.security.Signer

This class is deprecated and subject to removal in a future version of Java SE. It has been replaced by java.security.KeyStore, the java.security.cert package, and java.security.Principal.

17

Returns:

a callable object
java.util.concurrent.Executors.privilegedCallable
(Callable<T>
the underlying task
callable
)

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

17

Returns:

a callable object
java.util.concurrent.Executors.privilegedCallableUsingCurrentClassLoader
(Callable<T>
the underlying task
callable
)

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

17

Returns:

a thread factory
java.util.concurrent.Executors.privilegedThreadFactory
()

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

9
java.util.concurrent.ThreadPoolExecutor.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

17
java.util.logging.LogManager.checkAccess()

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

9
javax.imageio.spi.ServiceRegistry.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
javax.imageio.stream.FileCacheImageInputStream.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
javax.imageio.stream.FileImageInputStream.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
javax.imageio.stream.FileImageOutputStream.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
javax.imageio.stream.ImageInputStreamImpl.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

9
javax.imageio.stream.MemoryCacheImageInputStream.finalize()

Finalization has been deprecated for removal. See java.lang.Object#finalize for background information and details about migration options.

20
javax.management.loading.MLet

This API is part of Management Applets (m-lets), which is a legacy feature that allows loading of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.

20
javax.management.loading.MLetContent

This API is part of Management Applets (m-lets), which is a legacy feature that allows loading of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.

20
javax.management.loading.MLetMBean

This API is part of Management Applets (m-lets), which is a legacy feature that allows loading of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.

20
20
20
javax.management.loading.PrivateMLet

This API is part of Management Applets (m-lets), which is a legacy feature that allows loading of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.

16
21

Returns:

an object that implements the MBeanServerConnection interface by forwarding its methods to the remote MBean server on behalf of a given delegation subject.
javax.management.remote.JMXConnector.getMBeanServerConnection
(Subject
the Subject on behalf of which requests will be performed. Can be null, in which case requests will be performed on behalf of the authenticated Subject, if any.
delegationSubject
)

This method supported the legacy Subject Delegation feature, and is only useful in conjunction with other APIs which are deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement.

9
javax.naming.Context.APPLET

An environment property with this name is ignored while constructing an initial context. This constant was originally used as a property name to specify an Applet to retrieve parameters from, when creating an initial context. Currently any applet properties that need to be passed to an initial context should be copied into the environment hashtable:

Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
      ((Applet) this).getParameter(Context.INITIAL_CONTEXT_FACTORY));
    env.put(Context.PROVIDER_URL,
      ((Applet) this).getParameter(Context.PROVIDER_URL));
    // ... other properties ...

    Context ctx = new InitialContext(env);
9

Returns:

an ordered array of peer X.509 certificates, with the peer's own certificate first followed by any certificate authorities. (The certificates are in the original JSSE javax.security.cert.X509Certificate format).
javax.net.ssl.HandshakeCompletedEvent.getPeerCertificateChain
()

The getPeerCertificates() method that returns an array of java.security.cert.Certificate should be used instead.

9

Returns:

an ordered array of peer X.509 certificates, with the peer's own certificate first followed by any certificate authorities. (The certificates are in the original JSSE certificate javax.security.cert.X509Certificate format.)
javax.net.ssl.SSLSession.getPeerCertificateChain
()

The getPeerCertificates() method that returns an array of java.security.cert.Certificate should be used instead.

18

Returns:

the value returned by the PrivilegedAction's run method.
javax.security.auth.Subject.doAs
(final Subject
the Subject that the specified action will run as. This parameter may be null.
subject
,
final PrivilegedAction<T>
the code to be run as the specified Subject.
action
)

This method depends on AccessControlContext which, in conjunction with the Security Manager, is deprecated and subject to removal in a future release. However, performing work as a Subject is useful independent of the Security Manager. Thus, a replacement API named callAs has been added which can be used to perform the same work.

18

Returns:

the value returned by the PrivilegedExceptionAction's run method.
javax.security.auth.Subject.doAs
(final Subject
the Subject that the specified action will run as. This parameter may be null.
subject
,
final PrivilegedExceptionAction<T>
the code to be run as the specified Subject.
action
)

This method depends on AccessControlContext which, in conjunction with the Security Manager, is deprecated and subject to removal in a future release. However, performing work as a Subject is useful independent of the Security Manager. Thus, a replacement API named callAs has been added which can be used to perform the same work.

17

Returns:

the value returned by the PrivilegedAction's run method.
javax.security.auth.Subject.doAsPrivileged
(final Subject
the Subject that the specified action will run as. This parameter may be null.
subject
,
final PrivilegedAction<T>
the code to be run as the specified Subject.
action
,
final AccessControlContext
the AccessControlContext to be tied to the specified subject and action.
acc
)

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

17

Returns:

the value returned by the PrivilegedExceptionAction's run method.
javax.security.auth.Subject.doAsPrivileged
(final Subject
the Subject that the specified action will run as. This parameter may be null.
subject
,
final PrivilegedExceptionAction<T>
the code to be run as the specified Subject.
action
,
final AccessControlContext
the AccessControlContext to be tied to the specified subject and action.
acc
)

This method is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this method is also deprecated and subject to removal. There is no replacement for the Security Manager or this method.

17

Returns:

the Subject associated with the provided AccessControlContext, or null if no Subject is associated with the provided AccessControlContext.
javax.security.auth.Subject.getSubject
(final AccessControlContext
the AccessControlContext from which to retrieve the Subject.
acc
)

This method depends on AccessControlContext which, in conjunction with the Security Manager, is deprecated and subject to removal in a future release. However, obtaining a Subject is useful independent of the Security Manager. Thus, a replacement API named current() has been added which can be used to obtain the current subject.

17
javax.security.auth.SubjectDomainCombiner

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

9
javax.security.cert.Certificate

Use the classes in java.security.cert instead.

9
javax.security.cert.CertificateEncodingException

Use the classes in java.security.cert instead.

9
javax.security.cert.CertificateException

Use the classes in java.security.cert instead.

9
javax.security.cert.CertificateExpiredException

Use the classes in java.security.cert instead.

9
javax.security.cert.CertificateNotYetValidException

Use the classes in java.security.cert instead.

9
javax.security.cert.CertificateParsingException

Use the classes in java.security.cert instead.

9
javax.security.cert.X509Certificate

Use the classes in java.security.cert instead.

9
javax.swing.JApplet

The Applet API is deprecated, no replacement.

9
javax.swing.RepaintManager.addDirtyRegion(Applet
Applet to repaint, null results in nothing happening.
applet
,
int
X coordinate of the region to repaint
x
,
int
Y coordinate of the region to repaint
y
,
int
Width of the region to repaint
w
,
int
Height of the region to repaint
h
)

The Applet API is deprecated. See the java.applet package documentation for further information.

17
javax.swing.plaf.basic.BasicDirectoryModel.intervalAdded(ListDataEvent
list data event
e
)

Obsolete method, not used anymore.

17
javax.swing.plaf.basic.BasicDirectoryModel.intervalRemoved(ListDataEvent
list data event
e
)

Obsolete method, not used anymore.

17

Returns:

a comparison of the file names
javax.swing.plaf.basic.BasicDirectoryModel.lt
(File
a file
a
,
File
another file
b
)

Obsolete method, not used anymore.

17
17
17
17
17
17

Returns:

an instance of JFrame
javax.swing.plaf.basic.BasicToolBarUI.createFloatingFrame
(JToolBar
an instance of JToolBar
toolbar
)

It is recommended that BasicToolBarUI#createFloatingWindow(JToolBar) be used instead

21
22
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
0
0
0
16

Returns:

A set of socket options
jdk.net.Sockets.supportedOptions
(Class<?>
the type of java.net socket
socketType
)

use Socket#supportedOptions(), ServerSocket#supportedOptions(), or DatagramSocket#supportedOptions() instead.

9

Returns:

the parent applet or null
sun.awt.EmbeddedFrame.getAppletIfAncestorOf
(Component comp)

The Applet API is deprecated. See the java.applet package documentation for further information.

22
22

Returns:

the number of samples actually retrieved; or -1 if the load average is unobtainable.
sun.misc.Unsafe.getLoadAverage
(double[]
an array of double of size nelems
loadavg
,
int
the number of samples to be retrieved and must be 1 to 3.
nelems
)

Use java.lang.management.OperatingSystemMXBean#getSystemLoadAverage() instead.

22
22
22
22