RFR: 8283335 : Add exists and readAttributesIfExists methods to FileSystemProvider [v4]
Alan Bateman
alanb at openjdk.org
Fri Jul 1 12:58:33 UTC 2022
On Mon, 27 Jun 2022 16:43:55 GMT, Lance Andersen <lancea at openjdk.org> wrote:
>> Hi,
>>
>> Please review the following patch which will:
>>
>> - Enhance the java.nio.file.spi.FileSystemProvider abstract class to include the methods
>>
>> - public boolean exists(Path path, LinkOption... options)
>> - public <A extends BasicFileAttributes> A readAttributesIfExists(Path path, Class<A> type, LinkOption... options)
>>
>>
>> This change allows for providers to provide optimizations when the file's attributes are not needed.
>>
>> Mach5 tiers 1 - 3 run clean with this change
>>
>> The CSR may be viewed at [JDK-8283336](https://bugs.openjdk.org/browse/JDK-8283336)
>>
>>
>> Best,
>> Lance
>
> Lance Andersen has updated the pull request incrementally with one additional commit since the last revision:
>
> Updated tests based on feedback
test/jdk/java/nio/file/spi/TestDelegation.java line 111:
> 109: assertEquals(1, PROVIDER.findCall("exists").size());
> 110: assertEquals(2, PROVIDER.findCall("readAttributesIfExists").size());
> 111: PROVIDER.resetCalls();
One suggestion is to split these into testExists, testIsDirectory and testIsRegularFile so that the delegation of each method is tested in isolation.
-------------
PR: https://git.openjdk.org/jdk/pull/9249
More information about the core-libs-dev
mailing list