RFR: 8286735: (fc) FileChannel#map should document behavior when using custom file systems
Alan Bateman
alanb at openjdk.java.net
Wed May 18 07:25:55 UTC 2022
On Tue, 17 May 2022 16:05:37 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> > I think this feature request will require a lot more discussion on what the right level of optionality is. If a custom file system provider does not support all features (file locking, memory-mapped files, ..) then FileSystemProvider::newFileChannel should throw UOE.
>
> I wonder whether for the immediate purpose for which this issue was filed the changes to the `@throws UnsupportedOperationException` clauses should be removed and only the new `@implSpec` retained?
JDK-8286735 is a request for finer grain optionality. It cannot be evaluated in isolation because there will be others that will want file locking, or positional read/write to be optional too. The long standing position on this topic is that custom file system providers are not required to support FileChannel (FileSystemProvider::newFileChannel can throw UOE) so I think we have to be cautious about changing this because it would make FileChannel unusable - if you give me a reference to a FileChannel then I couldn't rely on anything if every feature were optional.
The change that adds an implSpec to the new FileChannel.map is okay but it's probably a separate JBS issue.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8739
More information about the nio-dev
mailing list