Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8273103

Delete deprecated for removal the empty finalize() in java.desktop module

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
      2d
    • Compatibility Kind:
      source, binary, behavioral
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      Some of the methods are "public", while the default access level of "finalize" method is "protected".
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      The "java.desktop" module has a few implementations of the finalize() which do nothing, deprecated since Java 9, and are marked "forRemoval = true" since Java 16.

      Solution

      Delete three "finalize()" methods.

      Specification

      src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
      
      -    /**
      -     * Frees the resources associated with an {@code ICC_Profile} object.
      -     *
      -     * @deprecated The {@code finalize} method has been deprecated. Subclasses
      -     *         that override {@code finalize} in order to perform cleanup should
      -     *         be modified to use alternative cleanup mechanisms and to remove
      -     *         the overriding {@code finalize} method. When overriding the
      -     *         {@code finalize} method, its implementation must explicitly
      -     *         ensure that {@code super.finalize()} is invoked as described in
      -     *         {@link Object#finalize}. See the specification for {@link
      -     *         Object#finalize()} for further information about migration
      -     *         options.
      -     */
      -    @Deprecated(since = "9", forRemoval = true)
      -    @SuppressWarnings("removal")
      -    protected void finalize() {
      -    }
      
      
      src/java.desktop/share/classes/java/awt/image/ColorModel.java
      
      -    /**
      -     * Disposes of system resources associated with this
      -     * {@code ColorModel} once this {@code ColorModel} is no
      -     * longer referenced.
      -     *
      -     * @deprecated The {@code finalize} method has been deprecated.
      -     *     Subclasses that override {@code finalize} in order to perform cleanup
      -     *     should be modified to use alternative cleanup mechanisms and
      -     *     to remove the overriding {@code finalize} method.
      -     *     When overriding the {@code finalize} method, its implementation must explicitly
      -     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
      -     *     See the specification for {@link Object#finalize()} for further
      -     *     information about migration options.
      -     */
      -    @Deprecated(since = "9", forRemoval = true)
      -    @SuppressWarnings("removal")
      -    public void finalize() {
      -    }
      
      
      src/java.desktop/share/classes/java/awt/image/IndexColorModel.java
      
      -    /**
      -     * Disposes of system resources associated with this
      -     * {@code ColorModel} once this {@code ColorModel} is no
      -     * longer referenced.
      -     *
      -     * @deprecated The {@code finalize} method has been deprecated.
      -     *     Subclasses that override {@code finalize} in order to perform cleanup
      -     *     should be modified to use alternative cleanup mechanisms and
      -     *     to remove the overriding {@code finalize} method.
      -     *     When overriding the {@code finalize} method, its implementation must explicitly
      -     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
      -     *     See the specification for {@link Object#finalize()} for further
      -     *     information about migration options.
      -     */
      -    @Deprecated(since = "9", forRemoval = true)
      -    @SuppressWarnings("removal")
      -    public void finalize() {
      -    }

      Link for convenience: https://github.com/openjdk/jdk/pull/5292/files

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serb Sergey Bylokhov
              Reporter:
              serb Sergey Bylokhov
              Reviewed By:
              Alexey Ivanov, Iris Clark, Kevin Rushforth, Philip Race, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: