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

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

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 18
    • client-libs
    • None
    • 2d
    • source, binary, behavioral
    • low
    • Some of the methods are "public", while the default access level of "finalize" method is "protected".
    • Java API
    • SE

      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

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

              Created:
              Updated:
              Resolved: