RFR: 5041655: (ch) FileLock: negative param and overflow issues [v6]

Alan Bateman alanb at openjdk.java.net
Thu Feb 10 13:44:10 UTC 2022


On Wed, 9 Feb 2022 23:58:43 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Add an implementation note to `java.nio.channels.FileLock.overlaps(long,long)` indicating that the method does not check its parameters. Adding such checks would be an incompatible change.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   5041655: Update spec of zero lock size in channels and remove from FileLock spec

src/java.base/share/classes/java/nio/channels/FileChannel.java line 1005:

> 1003:      *         A value of zero means to lock all bytes from the specified
> 1004:      *         starting position to the end of the file, regardless of whether
> 1005:      *         the file is subsequently extended or truncated

This looks okay but I think we will need to say something about the return FileLock object. It may be that we need to add text to the method description to say that a FileLock with size "Long.MAX_VALUE - position" is returning when called with a size of 0. What do you think?

-------------

PR: https://git.openjdk.java.net/jdk/pull/7254


More information about the nio-dev mailing list