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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • P4
    • None
    • 8u66
    • docs
    • generic
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: