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

Correction of finally Block tutorial

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • None
    • docs
    • None

      The finally block tutorial[1] has the following note:

      ==
      Note: If the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues.
      ==

      After consultation with dev members, it's agreed that the 2nd sentence is misleading and needs to be corrected. The JVMLS spec relating to this area[2] suggests that an interrupted thread will still have its finally block executed.

      [1]
      https://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html
      [2] https://docs.oracle.com/javase/specs/jls/se17/html/jls-14.html#jls-14.20.2

            bhoran Bernard Horan (Inactive)
            coffeys Sean Coffey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: