Details

    • Subcomponent:
    • Resolved In Build:
      b165

      Backports

        Description

        Finalizers are inherently problematic and their use can lead to performance issues,
        deadlocks, hangs, and other problematic behavior.

        Furthermore the timing of finalization is unpredictable with no guarantee that a finalizer will be called.
        Classes whose instances hold non-heap resources should provide a method
        to enable explicit release of those resources, and they should also implement
        java.lang.AutoCloseable if appropriate.

        The java.lang.ref.Cleaner and java.lang.ref.PhantomReference provide more flexible and
        efficient ways to release resources when an object becomes unreachable.

          Issue Links

            Activity

            Hide
            rriggs Roger Riggs added a comment -
            For JDK 9, it is proposed to deprecate Object.finalize and methods that override it within the JDK .
            Compilation warnings will be suppressed on current uses within the JDK.

            Future work will be to re-mediate or remove uses of finalize.
            Show
            rriggs Roger Riggs added a comment - For JDK 9, it is proposed to deprecate Object.finalize and methods that override it within the JDK . Compilation warnings will be suppressed on current uses within the JDK. Future work will be to re-mediate or remove uses of finalize.
            Show
            rriggs Roger Riggs added a comment - - edited Review thread:     http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-March/046650.html Webrev:      http://cr.openjdk.java.net/~rriggs/webrev-finalize-deprecate-8165641/
            Show
            rriggs Roger Riggs added a comment - Updated Review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-March/047017.html
            Hide
            rriggs Roger Riggs added a comment -
            Fix Request

            Why: Deprecating finalize is a first step to address the problems listed in the description above.
            What: Deprecate Object.finalize and add @deprecated recommendations
                 Also, deprecate Subclasses overrides of finalize and document
                 And add @ SuppressWarnings where needed
            Risk: Low - No runtime behavior will be changed;
                     Compiler warnings will be suppressed for references to the finalize method.
            Testing: Normal build and test for jdk.
             
            Webrev:
                http://cr.openjdk.java.net/~rriggs/webrev-finalize-deprecate-8165641/
            Show
            rriggs Roger Riggs added a comment - Fix Request Why: Deprecating finalize is a first step to address the problems listed in the description above. What: Deprecate Object.finalize and add @deprecated recommendations      Also, deprecate Subclasses overrides of finalize and document      And add @ SuppressWarnings where needed Risk: Low - No runtime behavior will be changed;          Compiler warnings will be suppressed for references to the finalize method. Testing: Normal build and test for jdk.   Webrev:      http://cr.openjdk.java.net/~rriggs/webrev-finalize-deprecate-8165641/
            Hide
            alanb Alan Bateman added a comment -
            I've added jdk9-fix-yes to this issue.
            Show
            alanb Alan Bateman added a comment - I've added jdk9-fix-yes to this issue.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/9289f04ddb54
            User: rriggs
            Date: 2017-04-05 14:27:45 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/9289f04ddb54 User: rriggs Date: 2017-04-05 14:27:45 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/9289f04ddb54
            User: lana
            Date: 2017-04-12 18:47:13 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/9289f04ddb54 User: lana Date: 2017-04-12 18:47:13 +0000

              People

              • Assignee:
                rriggs Roger Riggs
                Reporter:
                rriggs Roger Riggs
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: