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

AutoCloseable And Try-With-Resources Without Variable Declaration

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 16
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      Suggesting to modify javac to allow try-with-resources without a variable declaration, causing an implicit variable declaration to be inserted by the complier. This can be helpful in reducing code when dealing with resources that are opened and closed, but where the resource itself need not be exposed.
      Example:
      try (new SomethingToClose()) {
        ... do something while something to close is open
      }


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: