-
Bug
-
Resolution: Unresolved
-
P4
-
None
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.
"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.