RFR: 8288080: (fc) FileChannel::map for MemorySegments should state it always throws UOE
Uwe Schindler
uschindler at openjdk.java.net
Thu Jun 9 08:43:33 UTC 2022
On Wed, 8 Jun 2022 23:33:29 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Add an `@implSpec` annotation to the `java.nio.channels.FileChannel::map` method for mapped memory segments indicating that it always throws an `UnsupportedOperationException`.
src/java.base/share/classes/java/nio/channels/FileChannel.java line 1000:
> 998: * segment is unspecified and should not be relied upon.
> 999: *
> 1000: * @implSpec The {@code map(MapMode, long, long, MemorySession)} method of
This looks a bit strange to me, because for the reader it looks like the default file channels in Java also does this. I'd add some other sentence part explaining this.
Alternative: "The default implementation of `map(MapMode, long, long, MemorySession)` method in abstract `FileChannel` always throws an `UnsupportedOperationException`. Subclasses should override it."
-------------
PR: https://git.openjdk.java.net/jdk/pull/9095
More information about the nio-dev
mailing list