RFR: 8283335 : Add exists and readAttributesIfExists methods to FileSystemProvider [v2]
Alan Bateman
alanb at openjdk.org
Mon Jun 27 09:30:45 UTC 2022
On Sun, 26 Jun 2022 13:33:40 GMT, Lance Andersen <lancea at openjdk.org> wrote:
> I thought about using TestProvider and then talked myself out of it. So yes, I can do that. If you have a preferred name other than `TestOverRideFSPMethods` please let me know
The only change that should be needed to TestProvider is to implement the checkAccess method with:
Path delegate = theFileSystem.unwrap(file);
defaultProvider.checkAccess(delegate, modes);
With that change it should be easy to extend and override exists/readAttributesIfExists to record that they are called. The need to run with the test with -Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider goes away too and and should be much simpler to test that the expected delegation.
-------------
PR: https://git.openjdk.org/jdk/pull/9249
More information about the core-libs-dev
mailing list