RFR: 8339574: Behavior of File.is{Directory,File,Hidden} is not documented with respect to symlinks

Brian Burkhalter bpb at openjdk.org
Fri Sep 6 00:07:49 UTC 2024


On Thu, 5 Sep 2024 21:05:38 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Make explicit how the `java.io.File` methods `isDirectory`, `isFile`, and `isHidden` behave when the `File` represents a symbolic link.

If the `File` is a symbolic link, it looks after all that for most methods, the final target of link is used. The methods where the link itself is used are `isHidden()` (Unix only), and `delete()`. Given this, perhaps a better approach would be to add a statement in the class specification that links are followed unless a method specification states the contrary?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20878#issuecomment-2332924513


More information about the core-libs-dev mailing list