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

AutoCloseable And Try-With-Resources Without Variable Declaration

XMLWordPrintable

    • generic
    • generic

      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
      }


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

              Created:
              Updated:
              Resolved: