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

Project Coin: Allow final or effectively final variables to be used as resources in try-with-resources

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b130
    • Introduced In Version:
      7
    • Resolved In Build:
      b42
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        While general expression support was outlawed for the try-with-resources statement during the developement of Java SE 7, it would be helpful to allow limited expression support in the form of final or effectively final variables. Using (effectively) final variables avoids the need to declare a dummy variable for the purpose of using the try-with-resources statement and avoid the semantic ambiguity of whether the close method should be called on the initial or final value of the variable.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jlahoda Jan Lahoda
                Reporter:
                darcy Joe Darcy
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: