RFR: 8322166: Files.isReadable/isWritable/isExecutable expensive when file does not exist [v4]
Chen Liang
liach at openjdk.org
Mon Dec 18 22:38:39 UTC 2023
On Mon, 18 Dec 2023 17:22:10 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java line 365:
>>
>>> 363: UnixPath file = UnixPath.toUnixPath(path);
>>> 364: file.checkRead();
>>> 365: return access(file, R_OK) == 0 ? true : false;
>>
>> Just curious, why do we use redundant `? true : false` for a boolean value? Such a pattern did not exist in this file before this patch.
>
>> why do we use redundant `? true : false` for a boolean value?
>
> @liach What meaning do you intend by "redundant" here?
I mean we can just use `access(file, R_OK) == 0`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17133#discussion_r1430716011
More information about the nio-dev
mailing list