Deprecated List (Java SE 15 & JDK 15) (original) (raw)

com.sun.jdi.VirtualMachine.canAddMethod()

A JVM TI based JDWP back-end will never set this capability to true.

com.sun.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses()

A JVM TI based JDWP back-end will never set this capability to true.

com.sun.management.OperatingSystemMXBean.getFreePhysicalMemorySize()

com.sun.management.OperatingSystemMXBean.getSystemCpuLoad()

com.sun.management.OperatingSystemMXBean.getTotalPhysicalMemorySize()

com.sun.source.tree.CaseTree.getExpression()

java.awt.AWTKeyStroke.registerSubclass​(Class<?>)

java.awt.BorderLayout.addLayoutComponent​(String, Component)

replaced by addLayoutComponent(Component, Object).

java.awt.CardLayout.addLayoutComponent​(String, Component)

replaced byaddLayoutComponent(Component, Object).

java.awt.CheckboxGroup.getCurrent()

As of JDK version 1.1, replaced by getSelectedCheckbox().

java.awt.CheckboxGroup.setCurrent​(Checkbox)

As of JDK version 1.1, replaced by setSelectedCheckbox(Checkbox).

java.awt.Choice.countItems()

As of JDK version 1.1, replaced by getItemCount().

java.awt.color.ICC_Profile.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding thefinalize method, its implementation must explicitly ensure that super.finalize() is invoked as described inObject.finalize(). See the specification for Object.finalize() for further information about migration options.

java.awt.Component.action​(Event, Object)

As of JDK version 1.1, should register this component as ActionListener on component which fires action events.

java.awt.Component.bounds()

As of JDK version 1.1, replaced by getBounds().

java.awt.Component.deliverEvent​(Event)

As of JDK version 1.1, replaced by dispatchEvent(AWTEvent e).

java.awt.Component.disable()

As of JDK version 1.1, replaced by setEnabled(boolean).

java.awt.Component.enable()

As of JDK version 1.1, replaced by setEnabled(boolean).

java.awt.Component.enable​(boolean)

As of JDK version 1.1, replaced by setEnabled(boolean).

java.awt.Component.gotFocus​(Event, Object)

As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).

java.awt.Component.handleEvent​(Event)

As of JDK version 1.1 replaced by processEvent(AWTEvent).

java.awt.Component.hide()

As of JDK version 1.1, replaced by setVisible(boolean).

java.awt.Component.inside​(int, int)

As of JDK version 1.1, replaced by contains(int, int).

java.awt.Component.isFocusTraversable()

As of 1.4, replaced by isFocusable().

java.awt.Component.keyDown​(Event, int)

As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).

java.awt.Component.keyUp​(Event, int)

As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).

java.awt.Component.layout()

As of JDK version 1.1, replaced by doLayout().

java.awt.Component.locate​(int, int)

As of JDK version 1.1, replaced by getComponentAt(int, int).

java.awt.Component.location()

As of JDK version 1.1, replaced by getLocation().

java.awt.Component.lostFocus​(Event, Object)

As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).

java.awt.Component.minimumSize()

As of JDK version 1.1, replaced by getMinimumSize().

java.awt.Component.mouseDown​(Event, int, int)

As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

java.awt.Component.mouseDrag​(Event, int, int)

As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).

java.awt.Component.mouseEnter​(Event, int, int)

As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

java.awt.Component.mouseExit​(Event, int, int)

As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

java.awt.Component.mouseMove​(Event, int, int)

As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).

java.awt.Component.mouseUp​(Event, int, int)

As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

java.awt.Component.move​(int, int)

As of JDK version 1.1, replaced by setLocation(int, int).

java.awt.Component.nextFocus()

As of JDK version 1.1, replaced by transferFocus().

java.awt.Component.postEvent​(Event)

As of JDK version 1.1, replaced by dispatchEvent(AWTEvent).

java.awt.Component.preferredSize()

As of JDK version 1.1, replaced by getPreferredSize().

java.awt.Component.reshape​(int, int, int, int)

As of JDK version 1.1, replaced by setBounds(int, int, int, int).

java.awt.Component.resize​(int, int)

As of JDK version 1.1, replaced by setSize(int, int).

java.awt.Component.resize​(Dimension)

As of JDK version 1.1, replaced by setSize(Dimension).

java.awt.Component.show()

As of JDK version 1.1, replaced by setVisible(boolean).

java.awt.Component.show​(boolean)

As of JDK version 1.1, replaced by setVisible(boolean).

java.awt.Component.size()

As of JDK version 1.1, replaced by getSize().

java.awt.ComponentOrientation.getOrientation​(ResourceBundle)

java.awt.Container.countComponents()

As of JDK version 1.1, replaced by getComponentCount().

java.awt.Container.deliverEvent​(Event)

As of JDK version 1.1, replaced by dispatchEvent(AWTEvent e)

java.awt.Container.insets()

As of JDK version 1.1, replaced by getInsets().

java.awt.Container.layout()

As of JDK version 1.1, replaced by doLayout().

java.awt.Container.locate​(int, int)

As of JDK version 1.1, replaced by getComponentAt(int, int).

java.awt.Container.minimumSize()

As of JDK version 1.1, replaced by getMinimumSize().

java.awt.Container.preferredSize()

As of JDK version 1.1, replaced by getPreferredSize().

java.awt.datatransfer.DataFlavor.equals​(String)

java.awt.datatransfer.DataFlavor.normalizeMimeType​(String)

This method is never invoked by this implementation from 1.1 onwards

java.awt.datatransfer.DataFlavor.normalizeMimeTypeParameter​(String, String)

This method is never invoked by this implementation from 1.1 onwards

java.awt.Dialog.hide()

java.awt.Dialog.show()

java.awt.event.InputEvent.getModifiers()

java.awt.event.KeyEvent.getKeyModifiersText​(int)

java.awt.event.KeyEvent.setModifiers​(int)

as of JDK1.1.4

java.awt.FontMetrics.getMaxDecent()

As of JDK version 1.1.1, replaced by getMaxDescent().

java.awt.Frame.getCursorType()

As of JDK version 1.1, replaced by Component.getCursor().

java.awt.Frame.setCursor​(int)

As of JDK version 1.1, replaced by Component.setCursor(Cursor).

java.awt.Graphics.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

java.awt.Graphics.getClipRect()

As of JDK version 1.1, replaced by getClipBounds().

java.awt.image.ColorModel.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

java.awt.image.IndexColorModel.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

java.awt.image.renderable.RenderContext.concetenateTransform​(AffineTransform)

replaced byconcatenateTransform(AffineTransform).

java.awt.image.renderable.RenderContext.preConcetenateTransform​(AffineTransform)

replaced bypreConcatenateTransform(AffineTransform).

java.awt.List.addItem​(String)

replaced by add(String).

java.awt.List.addItem​(String, int)

replaced by add(String, int).

java.awt.List.allowsMultipleSelections()

As of JDK version 1.1, replaced by isMultipleMode().

java.awt.List.clear()

As of JDK version 1.1, replaced by removeAll().

java.awt.List.countItems()

As of JDK version 1.1, replaced by getItemCount().

java.awt.List.delItem​(int)

replaced by remove(String) and remove(int).

java.awt.List.delItems​(int, int)

As of JDK version 1.1, Not for public use in the future. This method is expected to be retained only as a package private method.

java.awt.List.isSelected​(int)

As of JDK version 1.1, replaced by isIndexSelected(int).

java.awt.List.minimumSize()

As of JDK version 1.1, replaced by getMinimumSize().

java.awt.List.minimumSize​(int)

As of JDK version 1.1, replaced by getMinimumSize(int).

java.awt.List.preferredSize()

As of JDK version 1.1, replaced by getPreferredSize().

java.awt.List.preferredSize​(int)

As of JDK version 1.1, replaced by getPreferredSize(int).

java.awt.List.setMultipleSelections​(boolean)

As of JDK version 1.1, replaced by setMultipleMode(boolean).

java.awt.Menu.countItems()

As of JDK version 1.1, replaced by getItemCount().

java.awt.MenuBar.countMenus()

As of JDK version 1.1, replaced by getMenuCount().

java.awt.MenuComponent.postEvent​(Event)

java.awt.MenuContainer.postEvent​(Event)

As of JDK version 1.1 replaced by dispatchEvent(AWTEvent).

java.awt.MenuItem.disable()

As of JDK version 1.1, replaced by setEnabled(boolean).

java.awt.MenuItem.enable()

As of JDK version 1.1, replaced by setEnabled(boolean).

java.awt.MenuItem.enable​(boolean)

As of JDK version 1.1, replaced by setEnabled(boolean).

java.awt.Polygon.getBoundingBox()

As of JDK version 1.1, replaced by getBounds().

java.awt.Polygon.inside​(int, int)

As of JDK version 1.1, replaced by contains(int, int).

java.awt.PrintJob.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

java.awt.Rectangle.inside​(int, int)

As of JDK version 1.1, replaced by contains(int, int).

java.awt.Rectangle.move​(int, int)

As of JDK version 1.1, replaced by setLocation(int, int).

java.awt.Rectangle.reshape​(int, int, int, int)

As of JDK version 1.1, replaced by setBounds(int, int, int, int).

java.awt.Rectangle.resize​(int, int)

As of JDK version 1.1, replaced by setSize(int, int).

java.awt.Scrollbar.getLineIncrement()

As of JDK version 1.1, replaced by getUnitIncrement().

java.awt.Scrollbar.getPageIncrement()

As of JDK version 1.1, replaced by getBlockIncrement().

java.awt.Scrollbar.getVisible()

As of JDK version 1.1, replaced by getVisibleAmount().

java.awt.Scrollbar.setLineIncrement​(int)

As of JDK version 1.1, replaced by setUnitIncrement(int).

java.awt.Scrollbar.setPageIncrement​(int)

As of JDK version 1.1, replaced by setBlockIncrement().

java.awt.ScrollPane.layout()

As of JDK version 1.1, replaced by doLayout().

java.awt.TextArea.appendText​(String)

As of JDK version 1.1, replaced by append(String).

java.awt.TextArea.insertText​(String, int)

As of JDK version 1.1, replaced by insert(String, int).

java.awt.TextArea.minimumSize()

As of JDK version 1.1, replaced by getMinimumSize().

java.awt.TextArea.minimumSize​(int, int)

As of JDK version 1.1, replaced by getMinimumSize(int, int).

java.awt.TextArea.preferredSize()

As of JDK version 1.1, replaced by getPreferredSize().

java.awt.TextArea.preferredSize​(int, int)

As of JDK version 1.1, replaced by getPreferredSize(int, int).

java.awt.TextArea.replaceText​(String, int, int)

As of JDK version 1.1, replaced by replaceRange(String, int, int).

java.awt.TextField.minimumSize()

As of JDK version 1.1, replaced by getMinimumSize().

java.awt.TextField.minimumSize​(int)

As of JDK version 1.1, replaced by getMinimumSize(int).

java.awt.TextField.preferredSize()

As of JDK version 1.1, replaced by getPreferredSize().

java.awt.TextField.preferredSize​(int)

As of JDK version 1.1, replaced by getPreferredSize(int).

java.awt.TextField.setEchoCharacter​(char)

As of JDK version 1.1, replaced by setEchoChar(char).

java.awt.Toolkit.getFontList()

java.awt.Toolkit.getFontMetrics​(Font)

As of JDK version 1.2, replaced by the Font method getLineMetrics.

java.awt.Toolkit.getMenuShortcutKeyMask()

java.awt.Window.applyResourceBundle​(String)

java.awt.Window.applyResourceBundle​(ResourceBundle)

java.awt.Window.hide()

java.awt.Window.postEvent​(Event)

As of JDK version 1.1 replaced by dispatchEvent(AWTEvent).

java.awt.Window.reshape​(int, int, int, int)

As of JDK version 1.1, replaced by setBounds(int, int, int, int).

java.awt.Window.show()

java.beans.Beans.instantiate​(ClassLoader, String, BeanContext, AppletInitializer)

java.io.ByteArrayOutputStream.toString​(int)

java.io.DataInputStream.readLine()

java.io.File.toURL()

This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via thetoURI method, and then converting the URI into a URL via the URI.toURL method.

java.io.ObjectInputStream.readLine()

This method does not properly convert bytes to characters. see DataInputStream for the details and alternatives.

java.io.ObjectOutputStream.PutField.write​(ObjectOutput)

This method does not write the values contained by thisPutField object in a proper format, and may result in corruption of the serialization stream. The correct way to write PutField data is by calling the ObjectOutputStream.writeFields() method.

java.lang.Character.isJavaLetter​(char)

Replaced by isJavaIdentifierStart(char).

java.lang.Character.isJavaLetterOrDigit​(char)

Replaced by isJavaIdentifierPart(char).

java.lang.Character.isSpace​(char)

Replaced by isWhitespace(char).

java.lang.Class.newInstance()

java.lang.ClassLoader.defineClass​(byte[], int, int)

java.lang.ClassLoader.getPackage​(String)

If multiple class loaders delegate to each other and define classes with the same package name, and one such loader relies on the lookup behavior of getPackage to return a Package from a parent loader, then the properties exposed by the Package may not be as expected in the rest of the program. For example, the Package will only expose annotations from thepackage-info.class file defined by the parent loader, even if annotations exist in a package-info.class file defined by a child loader. A more robust approach is to use theClassLoader.getDefinedPackage(java.lang.String) method which returns a Package for the specified class loader.

java.lang.invoke.MethodHandles.Lookup.hasPrivateAccess()

This method was originally designed to test PRIVATE access that implies full privilege access but MODULE access has since become independent of PRIVATE access. It is recommended to callMethodHandles.Lookup.hasFullPrivilegeAccess() instead.

java.lang.Object.finalize()

The finalization mechanism is inherently problematic. Finalization can lead to performance issues, deadlocks, and hangs. Errors in finalizers can lead to resource leaks; there is no way to cancel finalization if it is no longer necessary; and no ordering is specified among calls to finalize methods of different objects. Furthermore, there are no guarantees regarding the timing of finalization. The finalize method might be called on a finalizable object only after an indefinite delay, if at all. Classes whose instances hold non-heap resources should provide a method to enable explicit release of those resources, and they should also implement AutoCloseable if appropriate. The Cleaner and PhantomReference provide more flexible and efficient ways to release resources when an object becomes unreachable.

java.lang.Package.getPackage​(String)

If multiple class loaders delegate to each other and define classes with the same package name, and one such loader relies on the lookup behavior of getPackage to return a Package from a parent loader, then the properties exposed by the Package may not be as expected in the rest of the program. For example, the Package will only expose annotations from thepackage-info.class file defined by the parent loader, even if annotations exist in a package-info.class file defined by a child loader. A more robust approach is to use theClassLoader.getDefinedPackage(java.lang.String) method which returns a Package for the specified class loader.

java.lang.reflect.AccessibleObject.isAccessible()

This method is deprecated because its name hints that it checks if the reflected object is accessible when it actually indicates if the checks for Java language access control are suppressed. This method may return false on a reflected object that is accessible to the caller. To test if this reflected object is accessible, it should use AccessibleObject.canAccess(Object).

java.lang.reflect.Proxy.getProxyClass​(ClassLoader, Class<?>...)

java.lang.Runtime.Version.major()

As of Java SE 10, the first element of a version number is not the major-release number but the feature-release counter, incremented for every time-based release. Use the Runtime.Version.feature() method in preference to this method. For compatibility, this method returns the value of the feature element.

java.lang.Runtime.Version.minor()

As of Java SE 10, the second element of a version number is not the minor-release number but the interim-release counter, incremented for every interim release. Use the Runtime.Version.interim() method in preference to this method. For compatibility, this method returns the value of the interim element, or zero if it is absent.

java.lang.Runtime.Version.security()

As of Java SE 10, the third element of a version number is not the security level but the update-release counter, incremented for every update release. Use the Runtime.Version.update() method in preference to this method. For compatibility, this method returns the value of the update element, or zero if it is absent.

java.lang.SecurityManager.checkMulticast​(InetAddress, byte)

Use #checkPermission(java.security.Permission) instead

java.lang.String.getBytes​(int, int, byte[], int)

This method does not properly convert characters into bytes. As of JDK 1.1, the preferred way to do this is via theString.getBytes() method, which uses the platform's default charset.

java.lang.Thread.countStackFrames()

This method was originally designed to count the number of stack frames but the results were never well-defined and it depended on thread-suspension. This method is subject to removal in a future version of Java SE.

java.lang.Thread.resume()

java.lang.Thread.stop()

This method is inherently unsafe. Stopping a thread with Thread.stop causes it to unlock all of the monitors that it has locked (as a natural consequence of the uncheckedThreadDeath exception propagating up the stack). If any of the objects previously protected by these monitors were in an inconsistent state, the damaged objects become visible to other threads, potentially resulting in arbitrary behavior. Many uses 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, seeWhy are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

java.lang.Thread.suspend()

This method has been deprecated, as it is inherently deadlock-prone. If the target thread holds a lock on the monitor protecting a critical system resource when it is suspended, no thread can access this resource until the target thread is resumed. If the thread that would resume the target thread attempts to lock this monitor prior to calling resume, deadlock results. Such deadlocks typically manifest themselves as "frozen" processes. For more information, seeWhy are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

java.lang.ThreadGroup.allowThreadSuspension​(boolean)

The definition of this call depends on ThreadGroup.suspend(), which is deprecated. Further, the behavior of this call was never specified.

java.lang.ThreadGroup.resume()

This method is used solely in conjunction withThread.suspend and ThreadGroup.suspend, both of which have been deprecated, as they are inherently deadlock-prone. See Thread.suspend() for details.

java.lang.ThreadGroup.stop()

This method is inherently unsafe. SeeThread.stop() for details.

java.lang.ThreadGroup.suspend()

This method is inherently deadlock-prone. SeeThread.suspend() for details.

java.math.BigDecimal.divide​(BigDecimal, int)

java.math.BigDecimal.divide​(BigDecimal, int, int)

java.math.BigDecimal.setScale​(int, int)

java.net.DatagramSocketImpl.getTTL()

use getTimeToLive instead.

java.net.DatagramSocketImpl.setTTL​(byte)

use setTimeToLive instead.

java.net.MulticastSocket.getInterface()

java.net.MulticastSocket.getLoopbackMode()

java.net.MulticastSocket.getTTL()

use the getTimeToLive method instead, which returns an int instead of a byte.

java.net.MulticastSocket.joinGroup​(InetAddress)

java.net.MulticastSocket.leaveGroup​(InetAddress)

java.net.MulticastSocket.send​(DatagramPacket, byte)

Use the following code or its equivalent instead: ...... int ttl = mcastSocket.getTimeToLive(); mcastSocket.setTimeToLive(newttl); mcastSocket.send(p); mcastSocket.setTimeToLive(ttl); ......

java.net.MulticastSocket.setInterface​(InetAddress)

java.net.MulticastSocket.setLoopbackMode​(boolean)

java.net.MulticastSocket.setTTL​(byte)

use the setTimeToLive method instead, which usesint instead of byte as the type for ttl.

java.net.URLConnection.getDefaultRequestProperty​(String)

The instance specific getRequestProperty method should be used after an appropriate instance of URLConnection is obtained.

java.net.URLConnection.setDefaultRequestProperty​(String, String)

The instance specific setRequestProperty method should be used after an appropriate instance of URLConnection is obtained. Invoking this method will have no effect.

java.net.URLDecoder.decode​(String)

The resulting string may vary depending on the platform's default encoding. Instead, use the decode(String,String) method to specify the encoding.

java.net.URLEncoder.encode​(String)

The resulting string may vary depending on the platform's default encoding. Instead, use the encode(String,String) method to specify the encoding.

java.net.URLStreamHandler.setURL​(URL, String, String, int, String, String)

Use setURL(URL, String, String, int, String, String, String, String);

java.rmi.dgc.VMID.isUnique()

java.rmi.registry.RegistryHandler.registryImpl​(int)

no replacement. As of the Java 2 platform v1.2, RMI no longer uses the RegistryHandler to obtain the registry's implementation.

java.rmi.registry.RegistryHandler.registryStub​(String, int)

no replacement. As of the Java 2 platform v1.2, RMI no longer uses the RegistryHandler to obtain the registry's stub.

java.rmi.server.LoaderHandler.getSecurityContext​(ClassLoader)

no replacement

java.rmi.server.LoaderHandler.loadClass​(String)

no replacement

java.rmi.server.LoaderHandler.loadClass​(URL, String)

no replacement

java.rmi.server.LogStream.getDefaultStream()

no replacement

java.rmi.server.LogStream.getOutputStream()

no replacement

java.rmi.server.LogStream.log​(String)

no replacement

java.rmi.server.LogStream.parseLevel​(String)

no replacement

java.rmi.server.LogStream.setDefaultStream​(PrintStream)

no replacement

java.rmi.server.LogStream.setOutputStream​(OutputStream)

no replacement

java.rmi.server.LogStream.toString()

no replacement

java.rmi.server.LogStream.write​(byte[], int, int)

no replacement

java.rmi.server.LogStream.write​(int)

no replacement

java.rmi.server.Operation.getOperation()

no replacement

java.rmi.server.Operation.toString()

no replacement

java.rmi.server.RemoteCall.done()

no replacement

java.rmi.server.RemoteCall.executeCall()

no replacement

java.rmi.server.RemoteCall.getInputStream()

no replacement

java.rmi.server.RemoteCall.getOutputStream()

no replacement

java.rmi.server.RemoteCall.getResultStream​(boolean)

no replacement

java.rmi.server.RemoteCall.releaseInputStream()

no replacement

java.rmi.server.RemoteCall.releaseOutputStream()

no replacement

java.rmi.server.RemoteRef.done​(RemoteCall)

1.2 style stubs no longer use this method. Instead of using a sequence of method calls to the remote reference (newCall, invoke, and done), a stub uses a single method, invoke(Remote, Method, Object[], int), on the remote reference to carry out parameter marshalling, remote method executing and unmarshalling of the return value.

java.rmi.server.RemoteRef.invoke​(RemoteCall)

1.2 style stubs no longer use this method. Instead of using a sequence of method calls to the remote reference (newCall, invoke, and done), a stub uses a single method, invoke(Remote, Method, Object[], int), on the remote reference to carry out parameter marshalling, remote method executing and unmarshalling of the return value.

java.rmi.server.RemoteRef.newCall​(RemoteObject, Operation[], int, long)

1.2 style stubs no longer use this method. Instead of using a sequence of method calls on the stub's the remote reference (newCall, invoke, and done), a stub uses a single method, invoke(Remote, Method, Object[], int), on the remote reference to carry out parameter marshalling, remote method executing and unmarshalling of the return value.

java.rmi.server.RemoteStub.setRef​(RemoteStub, RemoteRef)

No replacement. The setRef method was intended for setting the remote reference of a remote stub. This is unnecessary, since RemoteStubs can be created and initialized with a remote reference through use of the RemoteStub(RemoteRef) constructor.

java.rmi.server.RMIClassLoader.getSecurityContext​(ClassLoader)

no replacement. As of the Java 2 platform v1.2, RMI no longer uses this method to obtain a class loader's security context.

java.rmi.server.RMIClassLoader.loadClass​(String)

replaced by loadClass(String,String) method

java.rmi.server.Skeleton.dispatch​(Remote, RemoteCall, int, long)

no replacement

java.rmi.server.Skeleton.getOperations()

no replacement

java.rmi.server.UnicastRemoteObject.exportObject​(Remote)

java.security.Provider.getVersion()

java.security.Security.getAlgorithmProperty​(String, String)

This method used to return the value of a proprietary property in the master file of the "SUN" Cryptographic Service Provider in order to determine how to parse algorithm-specific parameters. Use the new provider-based and algorithm-independentAlgorithmParameters and KeyFactory engine classes (introduced in the J2SE version 1.2 platform) instead.

java.security.Signature.getParameter​(String)

java.security.Signature.setParameter​(String, Object)

java.security.SignatureSpi.engineGetParameter​(String)

java.security.SignatureSpi.engineSetParameter​(String, Object)

java.sql.CallableStatement.getBigDecimal​(int, int)

use getBigDecimal(int parameterIndex) or getBigDecimal(String parameterName)

java.sql.Date.getHours()

java.sql.Date.getMinutes()

java.sql.Date.getSeconds()

java.sql.Date.setHours​(int)

java.sql.Date.setMinutes​(int)

java.sql.Date.setSeconds​(int)

java.sql.DriverManager.getLogStream()

Use getLogWriter

java.sql.DriverManager.setLogStream​(PrintStream)

Use setLogWriter

java.sql.PreparedStatement.setUnicodeStream​(int, InputStream, int)

Use setCharacterStream

java.sql.ResultSet.getBigDecimal​(int, int)

Use getBigDecimal(int columnIndex) or getBigDecimal(String columnLabel)

java.sql.ResultSet.getBigDecimal​(String, int)

Use getBigDecimal(int columnIndex) or getBigDecimal(String columnLabel)

java.sql.ResultSet.getUnicodeStream​(int)

use getCharacterStream in place ofgetUnicodeStream

java.sql.ResultSet.getUnicodeStream​(String)

use getCharacterStream instead

java.sql.Time.getDate()

java.sql.Time.getDay()

java.sql.Time.getMonth()

java.sql.Time.getYear()

java.sql.Time.setDate​(int)

java.sql.Time.setMonth​(int)

java.sql.Time.setYear​(int)

java.util.concurrent.atomic.AtomicBoolean.weakCompareAndSet​(boolean, boolean)

java.util.concurrent.atomic.AtomicInteger.weakCompareAndSet​(int, int)

java.util.concurrent.atomic.AtomicIntegerArray.weakCompareAndSet​(int, int, int)

java.util.concurrent.atomic.AtomicLong.weakCompareAndSet​(long, long)

java.util.concurrent.atomic.AtomicLongArray.weakCompareAndSet​(int, long, long)

java.util.concurrent.atomic.AtomicReference.weakCompareAndSet​(V, V)

java.util.concurrent.atomic.AtomicReferenceArray.weakCompareAndSet​(int, E, E)

java.util.concurrent.ThreadPoolExecutor.finalize()

java.util.Date.getDate()

As of JDK version 1.1, replaced by Calendar.get(Calendar.DAY_OF_MONTH).

java.util.Date.getDay()

As of JDK version 1.1, replaced by Calendar.get(Calendar.DAY_OF_WEEK).

java.util.Date.getHours()

As of JDK version 1.1, replaced by Calendar.get(Calendar.HOUR_OF_DAY).

java.util.Date.getMinutes()

As of JDK version 1.1, replaced by Calendar.get(Calendar.MINUTE).

java.util.Date.getMonth()

As of JDK version 1.1, replaced by Calendar.get(Calendar.MONTH).

java.util.Date.getSeconds()

As of JDK version 1.1, replaced by Calendar.get(Calendar.SECOND).

java.util.Date.getTimezoneOffset()

As of JDK version 1.1, replaced by -(Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / (60 * 1000).

java.util.Date.getYear()

As of JDK version 1.1, replaced by Calendar.get(Calendar.YEAR) - 1900.

java.util.Date.parse​(String)

As of JDK version 1.1, replaced by DateFormat.parse(String s).

java.util.Date.setDate​(int)

As of JDK version 1.1, replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date).

java.util.Date.setHours​(int)

As of JDK version 1.1, replaced by Calendar.set(Calendar.HOUR_OF_DAY, int hours).

java.util.Date.setMinutes​(int)

As of JDK version 1.1, replaced by Calendar.set(Calendar.MINUTE, int minutes).

java.util.Date.setMonth​(int)

As of JDK version 1.1, replaced by Calendar.set(Calendar.MONTH, int month).

java.util.Date.setSeconds​(int)

As of JDK version 1.1, replaced by Calendar.set(Calendar.SECOND, int seconds).

java.util.Date.setYear​(int)

As of JDK version 1.1, replaced by Calendar.set(Calendar.YEAR, year + 1900).

java.util.Date.toGMTString()

As of JDK version 1.1, replaced by DateFormat.format(Date date), using a GMT TimeZone.

java.util.Date.toLocaleString()

As of JDK version 1.1, replaced by DateFormat.format(Date date).

java.util.Date.UTC​(int, int, int, int, int, int)

As of JDK version 1.1, replaced by Calendar.set(year + 1900, month, date, hrs, min, sec) or GregorianCalendar(year + 1900, month, date, hrs, min, sec), using a UTCTimeZone, followed by Calendar.getTime().getTime().

java.util.logging.Logger.logrb​(Level, String, String, String, String)

java.util.logging.Logger.logrb​(Level, String, String, String, String, Object)

java.util.logging.Logger.logrb​(Level, String, String, String, String, Object[])

java.util.logging.Logger.logrb​(Level, String, String, String, String, Throwable)

java.util.logging.LogManager.getLoggingMXBean()

java.util.logging.LoggingMXBean is deprecated and replaced with java.lang.management.PlatformLoggingMXBean. UseManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class) instead.

java.util.logging.LogRecord.setMillis​(long)

LogRecord maintains timestamps with nanosecond resolution, using Instant values. For this reason,setInstant() should be used in preference to setMillis().

java.util.Properties.save​(OutputStream, String)

This method does not throw an IOException if an I/O error occurs while saving the property list. The preferred way to save a properties list is via the store(OutputStream out, String comments) method or thestoreToXML(OutputStream os, String comment) method.

javax.imageio.spi.ServiceRegistry.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

javax.imageio.stream.FileCacheImageInputStream.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

javax.imageio.stream.FileImageInputStream.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

javax.imageio.stream.FileImageOutputStream.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

javax.imageio.stream.ImageInputStreamImpl.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

javax.imageio.stream.MemoryCacheImageInputStream.finalize()

The finalize method has been deprecated. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. When overriding the finalize method, its implementation must explicitly ensure that super.finalize() is invoked as described in Object.finalize(). See the specification for Object.finalize() for further information about migration options.

javax.management.AttributeValueExp.setMBeanServer​(MBeanServer)

This method has no effect. The MBean Server used to obtain an attribute value is QueryEval.getMBeanServer().

javax.management.MBeanServer.deserialize​(String, byte[])

javax.management.MBeanServer.deserialize​(String, ObjectName, byte[])

Use getClassLoader to obtain the class loader for deserialization.

javax.management.MBeanServer.deserialize​(ObjectName, byte[])

Use getClassLoaderFor to obtain the appropriate class loader for deserialization.

javax.management.monitor.CounterMonitor.getDerivedGauge()

javax.management.monitor.CounterMonitor.getDerivedGaugeTimeStamp()

javax.management.monitor.CounterMonitor.getThreshold()

javax.management.monitor.CounterMonitor.setThreshold​(Number)

javax.management.monitor.CounterMonitorMBean.getDerivedGauge()

javax.management.monitor.CounterMonitorMBean.getDerivedGaugeTimeStamp()

javax.management.monitor.CounterMonitorMBean.getThreshold()

javax.management.monitor.CounterMonitorMBean.setThreshold​(Number)

javax.management.monitor.GaugeMonitor.getDerivedGauge()

javax.management.monitor.GaugeMonitor.getDerivedGaugeTimeStamp()

javax.management.monitor.GaugeMonitorMBean.getDerivedGauge()

javax.management.monitor.GaugeMonitorMBean.getDerivedGaugeTimeStamp()

javax.management.monitor.Monitor.getObservedObject()

javax.management.monitor.Monitor.setObservedObject​(ObjectName)

javax.management.monitor.MonitorMBean.getObservedObject()

javax.management.monitor.MonitorMBean.setObservedObject​(ObjectName)

javax.management.monitor.StringMonitor.getDerivedGauge()

javax.management.monitor.StringMonitor.getDerivedGaugeTimeStamp()

javax.management.monitor.StringMonitorMBean.getDerivedGauge()

javax.management.monitor.StringMonitorMBean.getDerivedGaugeTimeStamp()

javax.management.StringValueExp.setMBeanServer​(MBeanServer)

javax.management.ValueExp.setMBeanServer​(MBeanServer)

This method is not needed because aValueExp can access the MBean server in which it is being evaluated by using QueryEval.getMBeanServer().

javax.net.ssl.HandshakeCompletedEvent.getPeerCertificateChain()

javax.net.ssl.SSLSession.getPeerCertificateChain()

javax.sql.rowset.BaseRowSet.setUnicodeStream​(int, InputStream, int)

getCharacterStream should be used in its place

javax.swing.AbstractButton.getLabel()

- Replaced by getText

javax.swing.AbstractButton.setLabel​(String)

- Replaced by setText(text)

javax.swing.FocusManager.disableSwingFocusManager()

as of 1.4, replaced byKeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy)

javax.swing.FocusManager.isFocusManagerEnabled()

As of 1.4, replaced byKeyboardFocusManager.getDefaultFocusTraversalPolicy()

javax.swing.InputVerifier.shouldYieldFocus​(JComponent)

javax.swing.JComponent.disable()

As of JDK version 1.1, replaced by java.awt.Component.setEnabled(boolean).

javax.swing.JComponent.enable()

As of JDK version 1.1, replaced by java.awt.Component.setEnabled(boolean).

javax.swing.JComponent.getNextFocusableComponent()

As of 1.4, replaced by FocusTraversalPolicy.

javax.swing.JComponent.hide()

javax.swing.JComponent.isManagingFocus()

As of 1.4, replaced byComponent.setFocusTraversalKeys(int, Set) andContainer.setFocusCycleRoot(boolean).

javax.swing.JComponent.requestDefaultFocus()

As of 1.4, replaced byFocusTraversalPolicy.getDefaultComponent(Container).requestFocus()

javax.swing.JComponent.reshape​(int, int, int, int)

javax.swing.JComponent.setNextFocusableComponent​(Component)

As of 1.4, replaced by FocusTraversalPolicy

javax.swing.JInternalFrame.getMenuBar()

As of Swing version 1.0.3, replaced by getJMenuBar().

javax.swing.JInternalFrame.setMenuBar​(JMenuBar)

As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar m).

javax.swing.JList.getSelectedValues()

javax.swing.JMenuBar.getComponentAtIndex​(int)

replaced by getComponent(int i)

javax.swing.JPasswordField.getText()

As of Java 2 platform v1.2, replaced by getPassword.

javax.swing.JPasswordField.getText​(int, int)

As of Java 2 platform v1.2, replaced by getPassword.

javax.swing.JPopupMenu.getComponentAtIndex​(int)

javax.swing.JRootPane.getMenuBar()

As of Swing version 1.0.3 replaced by getJMenuBar().

javax.swing.JRootPane.setMenuBar​(JMenuBar)

As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar menu).

javax.swing.JTable.createScrollPaneForTable​(JTable)

As of Swing version 1.0.2, replaced by new JScrollPane(aTable).

javax.swing.JTable.sizeColumnsToFit​(boolean)

As of Swing version 1.0.3, replaced by doLayout().

javax.swing.JViewport.isBackingStoreEnabled()

As of Java 2 platform v1.3, replaced bygetScrollMode().

javax.swing.JViewport.setBackingStoreEnabled​(boolean)

As of Java 2 platform v1.3, replaced bysetScrollMode().

javax.swing.KeyStroke.getKeyStroke​(char, boolean)

use getKeyStroke(char)

javax.swing.plaf.basic.BasicSplitPaneUI.createKeyboardDownRightListener()

As of Java 2 platform v1.3.

javax.swing.plaf.basic.BasicSplitPaneUI.createKeyboardEndListener()

As of Java 2 platform v1.3.

javax.swing.plaf.basic.BasicSplitPaneUI.createKeyboardHomeListener()

As of Java 2 platform v1.3.

javax.swing.plaf.basic.BasicSplitPaneUI.createKeyboardResizeToggleListener()

As of Java 2 platform v1.3.

javax.swing.plaf.basic.BasicSplitPaneUI.createKeyboardUpLeftListener()

As of Java 2 platform v1.3.

javax.swing.plaf.basic.BasicSplitPaneUI.getDividerBorderSize()

As of Java 2 platform v1.3, instead set the border on the divider.

javax.swing.plaf.basic.BasicTextUI.modelToView​(JTextComponent, int)

javax.swing.plaf.basic.BasicTextUI.modelToView​(JTextComponent, int, Position.Bias)

javax.swing.plaf.basic.BasicTextUI.viewToModel​(JTextComponent, Point)

javax.swing.plaf.basic.BasicTextUI.viewToModel​(JTextComponent, Point, Position.Bias[])

javax.swing.plaf.metal.MetalComboBoxUI.editablePropertyChanged​(PropertyChangeEvent)

As of Java 2 platform v1.4.

javax.swing.plaf.metal.MetalComboBoxUI.removeListeners()

As of Java 2 platform v1.4.

javax.swing.plaf.metal.MetalScrollPaneUI.uninstallListeners​(JScrollPane)

javax.swing.plaf.multi.MultiTextUI.modelToView​(JTextComponent, int)

javax.swing.plaf.multi.MultiTextUI.modelToView​(JTextComponent, int, Position.Bias)

javax.swing.plaf.multi.MultiTextUI.viewToModel​(JTextComponent, Point)

javax.swing.plaf.multi.MultiTextUI.viewToModel​(JTextComponent, Point, Position.Bias[])

javax.swing.plaf.TextUI.getToolTipText​(JTextComponent, Point)

javax.swing.plaf.TextUI.modelToView​(JTextComponent, int)

javax.swing.plaf.TextUI.modelToView​(JTextComponent, int, Position.Bias)

javax.swing.plaf.TextUI.viewToModel​(JTextComponent, Point)

javax.swing.plaf.TextUI.viewToModel​(JTextComponent, Point, Position.Bias[])

javax.swing.RepaintManager.addDirtyRegion​(Applet, int, int, int, int)

javax.swing.ScrollPaneLayout.getViewportBorderBounds​(JScrollPane)

As of JDK version Swing1.1 replaced by JScrollPane.getViewportBorderBounds().

javax.swing.SwingUtilities.findFocusOwner​(Component)

As of 1.4, replaced byKeyboardFocusManager.getFocusOwner().

javax.swing.table.TableColumn.disableResizedPosting()

as of Java 2 platform v1.3

javax.swing.table.TableColumn.enableResizedPosting()

as of Java 2 platform v1.3

javax.swing.text.html.HTMLEditorKit.InsertHTMLTextAction.insertAtBoundry​(JEditorPane, HTMLDocument, int, Element, String, HTML.Tag, HTML.Tag)

As of Java 2 platform v1.3, use insertAtBoundary

javax.swing.text.JTextComponent.modelToView​(int)

javax.swing.text.JTextComponent.viewToModel​(Point)

javax.swing.text.LabelView.getFontMetrics()

FontMetrics are not used for glyph rendering when running in the JDK.

javax.swing.text.PasswordView.drawEchoCharacter​(Graphics, int, int, char)

javax.swing.text.PasswordView.drawSelectedText​(Graphics, int, int, int, int)

javax.swing.text.PasswordView.drawUnselectedText​(Graphics, int, int, int, int)

javax.swing.text.PlainView.drawLine​(int, Graphics, int, int)

javax.swing.text.PlainView.drawSelectedText​(Graphics, int, int, int, int)

javax.swing.text.PlainView.drawUnselectedText​(Graphics, int, int, int, int)

javax.swing.text.TableView.createTableCell​(Element)

Table cells can now be any arbitrary View implementation and should be produced by the ViewFactory rather than the table.

javax.swing.text.Utilities.drawTabbedText​(Segment, int, int, Graphics, TabExpander, int)

javax.swing.text.Utilities.getBreakLocation​(Segment, FontMetrics, int, int, TabExpander, int)

javax.swing.text.Utilities.getPositionAbove​(JTextComponent, int, int)

javax.swing.text.Utilities.getPositionBelow​(JTextComponent, int, int)

javax.swing.text.Utilities.getTabbedTextOffset​(Segment, FontMetrics, int, int, TabExpander, int)

javax.swing.text.Utilities.getTabbedTextOffset​(Segment, FontMetrics, int, int, TabExpander, int, boolean)

javax.swing.text.Utilities.getTabbedTextWidth​(Segment, FontMetrics, int, TabExpander, int)

javax.swing.text.View.modelToView​(int, Shape)

javax.swing.text.View.viewToModel​(float, float, Shape)

javax.swing.text.WrappedPlainView.drawLine​(int, int, Graphics, int, int)

javax.swing.text.WrappedPlainView.drawSelectedText​(Graphics, int, int, int, int)

javax.swing.text.WrappedPlainView.drawUnselectedText​(Graphics, int, int, int, int)

javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange​(Vector<?>, TreePath)

As of JDK version 1.7

javax.tools.StandardJavaFileManager.getJavaFileObjectsFromPaths​(Iterable<? extends Path>)

use StandardJavaFileManager.getJavaFileObjectsFromPaths(Collection) instead, to prevent the possibility of accidentally calling the method with a single Path as such an argument. Although Path implementsIterable<Path>, it would almost never be correct to pass a singlePath and have it be treated as an Iterable of its components.

javax.tools.ToolProvider.getSystemToolClassLoader()

This method is subject to removal in a future version of Java SE. Use the system tool provider orservice loader mechanisms to locate system tools as well as user-installed tools.

javax.xml.stream.XMLEventFactory.newInstance​(String, ClassLoader)

javax.xml.stream.XMLInputFactory.newInstance​(String, ClassLoader)

javax.xml.stream.XMLOutputFactory.newInstance​(String, ClassLoader)

org.ietf.jgss.GSSContext.acceptSecContext​(InputStream, OutputStream)

org.ietf.jgss.GSSContext.getMIC​(InputStream, OutputStream, MessageProp)

org.ietf.jgss.GSSContext.initSecContext​(InputStream, OutputStream)

org.ietf.jgss.GSSContext.unwrap​(InputStream, OutputStream, MessageProp)

org.ietf.jgss.GSSContext.verifyMIC​(InputStream, InputStream, MessageProp)

org.ietf.jgss.GSSContext.wrap​(InputStream, OutputStream, MessageProp)