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

Clarification Needed: Symbolic Link Handling in File API Specifications

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • core-libs

      In JDK-8339868 , the following class-level comment was added:

      "Unless otherwise noted, symbolic links are automatically redirected to the target of the link, whether they are provided by a pathname string or via a File object."

      From this, it is understood that symbolic links are generally expected to be resolved to their target files automatically (if nothing specified in method level description). However, upon reviewing various methods, it appears that this default behavior does not apply uniformly.

      For example, the renameTo() method’s specification explicitly clarifies that if the pathname is a symbolic link, the link itself is renamed—not its target (i.e., the symlink is not followed). A similar, explicit note should be included in the specifications of other relevant methods to improve consistency and clarify behavior.

      Proposed enhancement:
      Add notes to the specifications of the following methods to clearly document how symbolic links are handled, following the example set in the renameTo() method:

      getParent()
      getParentFile()
      getName()
      getPath()
      getAbsolutePath()
      getAbsoluteFile()
      createNewFile()
      toURI()
      ........
      ........

      This enhancement will ensure consistent documentation and behavior expectations regarding symbolic links across the File API.

            bpb Brian Burkhalter
            hnassour Hamza Nassour
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: