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

The suggested java.nio.file equivalent of File.deleteOnExit is erroneous

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 8u66
    • Fix Version/s: None
    • Component/s: docs
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      The documentation states that File.deleteOnExit is "Replaced by the DELETE_ON_CLOSE option specified in the createFile method."

      However, the Files.createFile method does not accept the DELETE_ON_CLOSE option. It takes FileAttributes as optional parameters, but not OpenOptions.

      Furthermore, the DELETE_ON_CLOSE mechanism is not the same thing as File.deleteOnExit anyway. There is no equivalent of deleteOnExit in the nio API.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would expect something along the lines of:

      "There is no equivalent of File.deleteOnExit. However, one can specify the DELETE_ON_CLOSE option when opening a file for reading and/or writing."
      ACTUAL -
      "File.deleteOnExit : Replaced by the DELETE_ON_CLOSE option specified in the createFile method"

      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/tutorial/essential/io/legacy.html#mapping

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: